Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-07-06, 15:16


lynxpl123







Wiek: 28
Na forum: 3519 dni
Posty: 3
Nick w MP: Cichowski



Respekt: 50

Siemanko, mam problem mianowicie z GUI, mianowicie mam pod bind je i jest to moje pierwsze gui pod bind. Do podpi?cia buttona z funkcja u?y?em handlera "onClientGUIClick", mianowicie po klikniecia przycisku i wy??czenia GUI wy?wietla b??d "already handled". Zrobi?em te GUI wy??cznie pod testy. Liczy?bym na popraw? mojego b??du o ile co? ?le zrobi?em.

O to kod clienta.

Kod:


GUIEditor = {
tab = {},
tabpanel = {},
label = {},
button = {},
window = {}
}
local screenW, screenH = guiGetScreenSize()
GUIEditor.window[1] = guiCreateWindow((screenW - 727) / 2, (screenH - 414) / 2, 727, 414, "VIP Panel", false)
guiSetVisible(GUIEditor.window[1], false)
guiWindowSetMovable(GUIEditor.window[1], false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFF7F92F")

GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 21, 708, 383, false, GUIEditor.window[1])
guiSetProperty(GUIEditor.tabpanel[1], "Text", "General")

GUIEditor.tab[1] = guiCreateTab("General", GUIEditor.tabpanel[1])

GUIEditor.button[1] = guiCreateButton(574, 15, 114, 51, "Heal", false, GUIEditor.tab[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFC2E2E")
buttonarmor = guiCreateButton(574, 76, 114, 51, "Armour", false, GUIEditor.tab[1])
guiSetProperty( buttonarmor, "NormalTextColour", "FF2F77FA")

GUIEditor.tab[2] = guiCreateTab("Vehicle's", GUIEditor.tabpanel[1])

GUIEditor.button[3] = guiCreateButton(19, 15, 144, 61, "Banshee", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[4] = guiCreateButton(19, 86, 144, 61, "Comet", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[5] = guiCreateButton(19, 157, 144, 61, "Sultan", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[6] = guiCreateButton(19, 228, 144, 61, "Jester", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[7] = guiCreateButton(173, 15, 144, 61, "Phoenix", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[8] = guiCreateButton(173, 86, 144, 61, "Super GT", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[9] = guiCreateButton(173, 157, 144, 61, "Turismo", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[10] = guiCreateButton(173, 228, 144, 61, "Infernus", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[11] = guiCreateButton(60, 299, 200, 42, "Fix Vehicle", false, GUIEditor.tab[2])
guiSetProperty(GUIEditor.button[11], "NormalTextColour", "FF20C624")

function gui()
if (guiGetVisible (GUIEditor.window[1]) == false) then
guiSetVisible(GUIEditor.window[1], true)
else
guiSetVisible(GUIEditor.window[1], false)
end
showCursor(not isCursorShowing())

addEventHandler("onClientGUIClick", buttonarmor, a1, true)
end
bindKey ("F2", "down", gui)



function a1()
triggerServerEvent("setarmour", localPlayer )
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-06, 15:39


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

poza addEventHandler jest jeszcze removeEventHandler

Dodam jeszcze, ?e masz gui tylko pod jedn? rozdzielczo??. W innych b?dzie wygl?da? inaczej. Je?li robisz to na guieditor polecam opcj? "relative"


function gui() 
    if (guiGetVisible (GUIEditor.window[1]) == falsethen 
        guiSetVisible(GUIEditor.window[1], true) 
        addEventHandler("onClientGUIClick"buttonarmora1true) 
        showCursor(true)
    else 
        guiSetVisible(GUIEditor.window[1], false) 
        removeEventHandler("onClientGUIClick"buttonarmora1) 
        showCursor(false)
    end 
end 
bindKey ("F2""down"gui


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-06, 19:21


lynxpl123







Wiek: 28
Na forum: 3519 dni
Posty: 3
Nick w MP: Cichowski



Respekt: 50

To o rozdzielczosci nie wiedzia?em tak samo jak i o tym ze istnieje removeEventHandler, to jakby? m?g? mi wyt?umaczy? co mia?bym zrobi? by problem znik?? W sensie jak go u?y? prawid?owo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-06, 19:23


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

No da?em ci przecie? wy?ej gotowca

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-07-06, 19:36


lynxpl123







Wiek: 28
Na forum: 3519 dni
Posty: 3
Nick w MP: Cichowski



Respekt: 50

ojeju, przepraszam Cie najmocniej, nie zauwa?y?em.

Postaw piwo autorowi tego posta
 

 
Tagi: gui :: pod :: bind
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku