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

Wysłany: 2015-12-17, 19:44


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

function zalogowany (thePlayer)
if getElementType(thePlayer) ~= "player" then return false end
triggerClientEvent(thePlayer,"OLzalogowany",root)
end
addEventHandler("onPlayerLogin",root,zalogowany)


2 linijka expend element at arg. thePlayer

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:18


Wittx

8===D






Wiek: 27
Na forum: 4935 dni
Posty: 121
Nick w MP: wittula

Piwa: 1906

Respekt: 120
Respekt: 120


Więcej informacji znajdziesz w Wikipedii MTA:

onPlayerLogin


Pierwszym argumentem w funkcji podpi?tej pod zdarzenie jest poprzednie konto gracza, nie element player.

addEventHandler('onPlayerLogin', root, function()
    triggerClientEvent(source, "OLzalogowany", source);
end);


Elementem player na kt?rym wykonywane jest zdarzenie jest source.
Cytat:

The source of this event is the player element that just logged in.


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:19


Terr9909

Skrypter LUA






Wiek: 27
Na forum: 4375 dni
Posty: 346
Nick w MP: Split

Piwa: 1043

Respekt: 182,8
Respekt: 182,8Respekt: 182,8

Sk?d thePlayer?

?ap ziomu?:
addEventHandler("onPlayerLogin", root, function()
if getElementType(source) ~= "player" then return end
triggerClientEvent(source, "OLzalogowany", root)
end
end)



@@ up
by?e? pierwszy :/

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:23


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Dziala lecz gui nie pokazuje :(

c side
addEvent("OLzalogowanyOL",true)
addEventHandler("OLzalogowanyOL", resourceRoot,
    function(player)
        okno = guiCreateWindow(0.30, 0.31, 0.40, 0.31, "Wyb?r spawnu", true)
        guiWindowSetSizable(okno, false)

        ls = guiCreateButton(0.01, 0.08, 0.18, 0.13, "Los Santos", true, okno)
        guiSetProperty(ls, "NormalTextColour", "FFAAAAAA")
        lv = guiCreateButton(0.01, 0.24, 0.18, 0.13, "Las Venturas", true, okno)
        guiSetProperty(lv, "NormalTextColour", "FFAAAAAA")
        sf = guiCreateButton(0.01, 0.40, 0.18, 0.13, "San Fierro", true, okno)
        guiSetProperty(sf, "NormalTextColour", "FFAAAAAA")
        fc = guiCreateButton(0.01, 0.56, 0.18, 0.13, "Fort Carson", true, okno)
        guiSetProperty(fc, "NormalTextColour", "FFAAAAAA")
        infols = guiCreateLabel(0.19, 0.08, 0.80, 0.13, "Przechowywalnia\nPrace Dorywcze\nTuning Shop", true, okno)
        guiLabelSetHorizontalAlign(infols, "center", false)
        guiLabelSetVerticalAlign(infols, "center")
        infolv = guiCreateLabel(0.19, 0.24, 0.80, 0.13, "Salon Samochodowy\nPrace Dorywcze\nStra? Po?arna", true, okno)
        guiLabelSetHorizontalAlign(infolv, "center", false)
        guiLabelSetVerticalAlign(infolv, "center")
        infosf = guiCreateLabel(0.19, 0.40, 0.80, 0.13, "Urz?d Miasta\nPrace Dorywcze\nSzpital", true, okno)
        guiLabelSetHorizontalAlign(infosf, "center", false)
        guiLabelSetVerticalAlign(infosf, "center")
        infofc = guiCreateLabel(0.19, 0.56, 0.80, 0.13, "Policja\nPrace Dorywcze\nGie?da\nMechanik", true, okno)
        guiLabelSetHorizontalAlign(infofc, "center", false)    
        showCursor(false,true)
    end
)


s
addEventHandler('onPlayerLogin', root, function()
    triggerClientEvent(source, "OLzalogowany", source)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:34


Wittx

8===D






Wiek: 27
Na forum: 4935 dni
Posty: 121
Nick w MP: wittula

Piwa: 1906

Respekt: 120
Respekt: 120

Zdarzenie klienta do kt?rego si? odwo?ujesz po stronie serwera nie istnieje. Nazwy si? nie zgadzaj?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:38


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

sory, tam jest OLzalogowanyOL, ale i tak nie dziala

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:41


Wittx

8===D






Wiek: 27
Na forum: 4935 dni
Posty: 121
Nick w MP: wittula

Piwa: 1906

Respekt: 120
Respekt: 120

Kod:

addEventHandler("OLzalogowanyOL", resourceRoot,


Dlaczego resourceRoot?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-12-17, 20:42


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4471 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

ok dziala mialo byc root :)

Postaw piwo autorowi tego posta
 

 
Tagi: theplayer
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » thePlayer 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