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

Wysłany: 2015-09-30, 20:59


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Witam :) kod mojego gui stworzonego na szybko w edytorze to

bindKey("x","down", function()
 if not GUIEditor.window[1then return end
 if guiGetVisible(GUIEditor.window[1]) then
  guiSetVisible(GUIEditor.window[1], false)
  showCursor(false)
 else
  guiSetVisible(GUIEditor.window[1], true)
  showCursor(true)
 end
end)
GUIEditor = {
    button = {},
    window = {},
    label = {}
}
addEventHandler("onClientResourceStart"resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(629198161171"Panel pojazd?w"false)
guiSetVisible(GUIEditor.window[1], false)
        guiWindowSetMovable(GUIEditor.window[1], false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 0.58)
        guiSetProperty(GUIEditor.window[1], "CaptionColour""F6FEFFFE")

        GUIEditor.button[1] = guiCreateButton(9285920"Teleportuj"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[1], "default-small")
        guiSetProperty(GUIEditor.button[1], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(88285920"Napraw"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "default-small")
        guiSetProperty(GUIEditor.button[2], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[3] = guiCreateButton(9585920"Usun"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[3], "default-small")
        guiSetProperty(GUIEditor.button[3], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[4] = guiCreateButton(88585920"Flipuj"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[4], "default-small")
        guiSetProperty(GUIEditor.button[4], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[5] = guiCreateButton(88885920"Otworz"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[5], "default-small")
        guiSetProperty(GUIEditor.button[5], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[6] = guiCreateButton(91185920"Odeslij"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[6], "default-small")
        guiSetProperty(GUIEditor.button[6], "NormalTextColour""FFAAAAAA")
        GUIEditor.button[7] = guiCreateButton(881185920"Zamknij"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[7], "default-small")
        guiSetProperty(GUIEditor.button[7], "NormalTextColour""FFAAAAAA")
        GUIEditor.label[1] = guiCreateLabel(914414817"Created by LEURCEDICIUS"falseGUIEditor.window[1])
        GUIEditor.button[8] = guiCreateButton(9885920"Buchnij"falseGUIEditor.window[1])
        guiSetFont(GUIEditor.button[8], "default-small")
        guiSetProperty(GUIEditor.button[8], "NormalTextColour""FFAAAAAA")    
    end
)


jego type w meta.xml to client .. pytanie brzmi jak podpisa? funkcje s-side pod przycisk w gui c-side ? po klikni?ciu w inny przycisk chcia?bym ?eby wcze?nejsza funkcja si? automatycznie wy??cza?a poniewa? wszystkie
"addEventHandler ( "onClientGUIClick", nazwabuttona, funkcja )"

b?d? podpisane pod jeden przycisk myszy.
Z g?ry dzi?kuje za odpowied? :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 21:08


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Jezeli dobrze zrozumialem, to robisz to tak :


s-side

addEvent("funkcja"true)
addEventHandler("funkcja"root, function()
tutaj to co chcesz
end



c - side

triggerServerEvent("funkcja"localPlayer)


i wtedy to co jest s-side w evencie 'funkcja' przenosi nam na cside

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 21:24


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Dzi?ki,w?a?nie o to chodzi?o :D a wiesz mo?e jak rozwi?za? problem z tym ?eby ka?dy przycisk by? podpisany pod jeden bind(mouse) ale po klikni?ciu ka?da funkcja dzia?a?a osobno ? tzn .. wybieram "naprawa" i naprawiam pojazd,teraz chce je odes?a? wi?c wybieram "ode?lij" i klikam kursorem na pojazd..ale nie chce ?eby funkcja "naprawa" by?a aktywna gdy b?dzie aktywna funkcja "ode?lij"...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 21:41


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4838 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

skoro masz te opcje typu przecho / naprawa to one na pewno sa podpisane pod jakas globalna / lokaln? zmienn?.

if element(blabla) == vehicle then
if zmienna == "odeslij" then
odsylaj
elseif zmienna=="napraw" then
napraw
end
end

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-30, 21:53


INVWHIL3

*Padawan Lua*






Wiek: 27
Na forum: 3968 dni
Posty: 41
Nick w MP: LEURCEDICIUS

Piwa: 472

Respekt: 50

Dzi?ki wielkie ! :mrgreen:
edit@:
c-side
triggerServerEvent("napraw"localPlayer)


s-side
addEvent("napraw"true)
addEventHandler "onElementClicked"root,function()
    function ( mouseButton )
        local elementType getElementType source )
        if ( elementType == "vehicle" then
            if ( mouseButton == "right" then 
                fixVehicle source )
            end
        elseif ( elementType == "player" then
            local car getPedOccupiedVehicle source )
            if ( mouseButton == "right" then 
                fixVehicle car )
            end
        end
    end
)


bind buttona:
addEventHandler "onClientGUIClick"mouse1napraw )


?e tak ma to wygl?da? ? (sorry ?e tak si? wypytuje ale dopiero od 2dni bawi? si? w lua ._.)

Postaw piwo autorowi tego posta
 

 
Tagi: funkcje :: buttony :: gui
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