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

Wysłany: 2016-04-05, 13:21


Odważny

Początki LUA :P






Wiek: 26
Na forum: 3880 dni
Posty: 140
Nick w MP: ReseT_

Piwa: 166

Respekt: 50

Mam problem z montowaniem MK, mianowicie gdy kto? wjedzie w marker to kazdemu wyswietla sie GUI z wyborem MK.
Kod strona clienta:


GUIEditor = {
    button = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(339, 179, 499, 460, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 0.83)

        GUIEditor.button[1] = guiCreateButton(25, 37, 115, 58, "MK-1 Przy?pieszenie\n (3900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(140, 37, 113, 58, "MK-1 Pr?dko??\n (4600$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[3] = guiCreateButton(261, 38, 220, 57, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[4] = guiCreateButton(25, 103, 115, 51, "MK-2 Przy?pieszenie\n (5100$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[5] = guiCreateButton(138, 103, 115, 51, "MK-2 Pr?dko??\n (5900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[6] = guiCreateButton(260, 103, 221, 51, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[7] = guiCreateButton(25, 161, 115, 50, "MK-3 Przy?pieszenie\n (6300$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[8] = guiCreateButton(141, 160, 112, 51, "MK-3 Pr?dko??\n (6900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[9] = guiCreateButton(261, 162, 220, 49, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[10] = guiCreateButton(62, 369, 383, 81, "Zamknij okno", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFAAAAAA")    
    end
)


addEventHandler("onClientResourceStart",resourceRoot,
function()
guiSetVisible(GUIEditor.window[1],false)
end
)

marker = createMarker( -2479, -175, 24.5, 'cylinder', 3.0, 0, 255, 0, 70)

function hit()
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
end
addEventHandler("onClientMarkerHit", marker, hit)



function mk1()
if source ~= GUIEditor.button[1] then return end
    triggerServerEvent("ZmienHandling", localPlayer)--MK1 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk1)


function mk2()
if source ~= GUIEditor.button[2] then return end
    triggerServerEvent("ZmienHandling2", localPlayer)--MK1 predko?c
end

addEventHandler ( "onClientGUIClick", root, mk2)

function mk3()
if source ~= GUIEditor.button[4] then return end
    triggerServerEvent("ZmienHandling4", localPlayer)--MK2 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk3)


function mk4()
if source ~= GUIEditor.button[5] then return end
    triggerServerEvent("ZmienHandling5", localPlayer)--MK2 pr?dko??
end

addEventHandler ( "onClientGUIClick", root, mk4)


function mk5()
if source ~= GUIEditor.button[7] then return end
    triggerServerEvent("ZmienHandling12", localPlayer)--MK3 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk5)


function mk6()
if source ~= GUIEditor.button[8] then return end
    triggerServerEvent("ZmienHandling11", localPlayer)--MK3 pr?dko??
end
addEventHandler ( "onClientGUIClick", root, mk6)



function zamknij()
if source ~= GUIEditor.button[10] then return end
   guiSetVisible(GUIEditor.window[1], localPlayer)--MK3 pr?dko??
end
addEventHandler ( "onClientGUIClick", root, zamknij)


function zamykamy()
if source ~= GUIEditor.button[10] then return end
guiSetVisible(GUIEditor.window[1],false)
showCursor(false)
end

addEventHandler ( "onClientGUIClick", root, zamykamy)


Podpis
, pomogłem Ci? Wynagrodź mnie :piwo: :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-05, 14:28


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

function hit(plr)
if plr ~= localPlayer then return end
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
end
addEventHandler("onClientMarkerHit", marker, hit)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-05, 17:05


Odważny

Początki LUA :P






Wiek: 26
Na forum: 3880 dni
Posty: 140
Nick w MP: ReseT_

Piwa: 166

Respekt: 50

AteX, Problem dalej wyst?puje

Podpis
, pomogłem Ci? Wynagrodź mnie :piwo: :P
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-05, 17:08


Emm

***** ***






Wiek: 32
Na forum: 4021 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6171

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Spr?buj tak xd
function hit(el)
if el ~= localPlayer then 
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
end
end
addEventHandler("onClientMarkerHit", marker, hit)


Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-05, 21:23


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611



GUIEditor = {
    button = {},
    window = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(339, 179, 499, 460, "", false)
        guiSetVisible(GUIEditor.window[1],false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 0.83)

        GUIEditor.button[1] = guiCreateButton(25, 37, 115, 58, "MK-1 Przy?pieszenie\n (3900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[2] = guiCreateButton(140, 37, 113, 58, "MK-1 Pr?dko??\n (4600$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[3] = guiCreateButton(261, 38, 220, 57, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[4] = guiCreateButton(25, 103, 115, 51, "MK-2 Przy?pieszenie\n (5100$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[5] = guiCreateButton(138, 103, 115, 51, "MK-2 Pr?dko??\n (5900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[6] = guiCreateButton(260, 103, 221, 51, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[7] = guiCreateButton(25, 161, 115, 50, "MK-3 Przy?pieszenie\n (6300$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[8] = guiCreateButton(141, 160, 112, 51, "MK-3 Pr?dko??\n (6900$)", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[9] = guiCreateButton(261, 162, 220, 49, "Demont", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FFAAAAAA")
        GUIEditor.button[10] = guiCreateButton(62, 369, 383, 81, "Zamknij okno", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFAAAAAA")    
    end
)



marker = createMarker( -2479, -175, 24.5, 'cylinder', 3.0, 0, 255, 0, 70)

function hit(ele)
    if source == marker then else return end
    if getElementType( ele ) == "player" then else return end
    if ele == getLocalPlayer() then else return end
    if isElementWithinMarker ( ele, marker ) then else return end
    guiSetVisible(GUIEditor.window[1], true)
    showCursor(true)
end
addEventHandler("onClientMarkerHit", marker, hit)



function mk1()
if source ~= GUIEditor.button[1] then return end
    triggerServerEvent("ZmienHandling", localPlayer)--MK1 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk1)


function mk2()
if source ~= GUIEditor.button[2] then return end
    triggerServerEvent("ZmienHandling2", localPlayer)--MK1 predko?c
end

addEventHandler ( "onClientGUIClick", root, mk2)

function mk3()
if source ~= GUIEditor.button[4] then return end
    triggerServerEvent("ZmienHandling4", localPlayer)--MK2 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk3)


function mk4()
if source ~= GUIEditor.button[5] then return end
    triggerServerEvent("ZmienHandling5", localPlayer)--MK2 pr?dko??
end

addEventHandler ( "onClientGUIClick", root, mk4)


function mk5()
if source ~= GUIEditor.button[7] then return end
    triggerServerEvent("ZmienHandling12", localPlayer)--MK3 przy?pieszenie
end

addEventHandler ( "onClientGUIClick", root, mk5)


function mk6()
if source ~= GUIEditor.button[8] then return end
    triggerServerEvent("ZmienHandling11", localPlayer)--MK3 pr?dko??
end
addEventHandler ( "onClientGUIClick", root, mk6)



function zamknij()
if source ~= GUIEditor.button[10] then return end
   guiSetVisible(GUIEditor.window[1], localPlayer)--MK3 pr?dko??
end
addEventHandler ( "onClientGUIClick", root, zamknij)


function zamykamy()
if source ~= GUIEditor.button[10] then return end
guiSetVisible(GUIEditor.window[1],false)
showCursor(false)
end

addEventHandler ( "onClientGUIClick", root, zamykamy)

Sprawdz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-05, 21:49


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

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

Mo?e milion tych warunk?w luki? x'd



function hit(el)
if el == localPlayer then 
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
end
end
addEventHandler("onClientMarkerHit", marker, hit)


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-04-05, 23:24


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Jurandovsky, co do miliona warunk?w to ka?dy zabezpiecza funkcj?.
A co do kodu Twojego to dalej ka?demu si? b?dzie w??cza?, poniewa? nie jest sprawdzanie czy jest odpowiedni marker w kt?ry gracz powinien wjecha?.

Postaw piwo autorowi tego posta
 

 
Tagi: kazdym :: sie :: wyswietla :: 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 » Kazdym sie wyswietla 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