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

Wysłany: 2016-07-30, 08:42


MartinPanZycia

Zielony w LUA






Wiek: 27
Na forum: 3869 dni
Posty: 477
Nick w MP: Rodzaje

Piwa: 877

Respekt: 70,5

Ostrzeżeń: 40%
Elo , mam kod , tylko nie wiem jak odpowiednim buttonom , dac funkcj? , pierw dam 2 kody pierwsze od mojeog skryptu , a pozniej kod z gui .

function getElementsWithinMarker(marker)
    if (not isElement(marker) or getElementType(marker) ~= "marker") then
        return false
    end
    local markerColShape = getElementColShape(marker)
    local elements = getElementsWithinColShape(markerColShape, "player")
    return elements
end
local marker = createMarker(1821.38318, -1683.33215, 13.38281 , "cylinder")
 
function markerHit ()
if not source == marker then return end
local elementy = getElementsWithinMarker(marker)
    if #elementy==1 then
        for i, v in ipairs (elementy) do
            setElementPosition(v,2143.23804, 1547.52258, 10.82031)
        end
    end
end
addEventHandler( "onMarkerHit", marker, markerHit )


teraz gui


GUIEditor = {
    checkbox = {},
    button = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        napad = guiCreateWindow(438, 185, 467, 306, "Potwied? Napad na Bank", false)
        guiWindowSetSizable(napad, false)
        guiSetAlpha(napad, 0.58)
        guiSetProperty(napad, "CaptionColour", "FFFEFEFE")
        GUIEditor.button[1] = guiCreateButton(194, 129, 15, 15, "", false, napad)
        GUIEditor.button[2] = guiCreateButton(20, 233, 119, 52, "Akceptuj?", false, napad)
        GUIEditor.button[3] = guiCreateButton(317, 234, 140, 61, "Odrzu?", false, napad)    
    end
)


teraz nwm nie wiem jak to zrobi? ,?eby po wej?ciu w marker , wy?wietla? si? panel i po nacisni?ciu button , GUIEditor.button[2] = guiCreateButton(20, 233, 119, 52, "Akceptuj?", false, napad) , teleportowa?o .

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 09:09


tokelpl

Lua Warjat






Wiek: 25
Na forum: 4759 dni
Posty: 34
Nick w MP: Tomekb530

Piwa: 287

Respekt: 70

funkcj? przypisujesz handlerem "onClientGUIClick" Pami?taj ?eby podpi?? to pod element lokalnego gracza. Co? Takiego
addEventHandler("onClientGUIClick",button,
function(buton)

end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 12:23


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

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



        napad = guiCreateWindow(438, 185, 467, 306, "Potwied? Napad na Bank", false)
        guiWindowSetSizable(napad, false)
        guiSetAlpha(napad, 0.58)
        guiSetProperty(napad, "CaptionColour", "FFFEFEFE")
        buttonEmpty = guiCreateButton(194, 129, 15, 15, "", false, napad)
        buttonAccept = guiCreateButton(20, 233, 119, 52, "Akceptuj?", false, napad)
        buttonRefuse = guiCreateButton(317, 234, 140, 61, "Odrzu?", false, napad)    

local marker = createMarker(uzupelnij parametry)

addEventHandler("onClientMarkerHit", marker, function(el, md)
if el ~= localPlayer then return end
if not md then return end
guiSetVisible(napad, true)
showCursor(true, false)
end)

addEventHandler("onClientGUIClick", root, function(btn, state)
 if btn == "left" and state == "up" then
   if source == buttonRefuse then
      guiSetVisible(napad, false)
      showCursor(false)
   end
 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: 2016-07-30, 15:27


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

MartinPanZycia, polecam takie u?ycie stosowa?.
function function_name (btn, state)
    if btn== "left" and state == "up" then 
        if source == button then
            --Nasz kod 
        end
    end
end
addEventHandler("onClientGUIClick", button, function_name)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 15:30


MartinPanZycia

Zielony w LUA






Wiek: 27
Na forum: 3869 dni
Posty: 477
Nick w MP: Rodzaje

Piwa: 877

Respekt: 70,5

Ostrzeżeń: 40%
Jurandovsky,
thx , wielkie za pomoc ! :piwo: :piwo: :piwo:

Podpis
Cześć w MTA jestem jako Rodzaje.
Wszystko jest po staremu nie zamierzam stawiać RPG.
Postaw piwo autorowi tego posta
 

 
Tagi: drugie :: spotkanie :: 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 » drugie spotkanie z GUI 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