------------------- Funkcja sprawdza czy gracz jest zalogowany na konto
function zalogowany ()
local gracz = getPlayerAccount ( source )
if ( gracz ) then
if not isGuestAccount ( gracz ) then
local punkty = getAccountData ( gracz, "GP" )
if ( punkty ) then
setElementData(source, "GP", tonumber(punkty))
end
end
end
end
--------------------- Je?li gracz wyszed? z gry
function wyszedl ()
local gracz = getPlayerAccount ( source )
if ( gracz ) then
if not isGuestAccount ( gracz ) then
local punkty = getElementData ( source, "GP" )
if ( punkty ) then
setAccountData ( gracz, "GP", punkty )
end
end
end
end
addEventHandler ( "onPlayerLogin", getRootElement (), zalogowany )
addEventHandler ( "onPlayerQuit", getRootElement (), wyszedl )
addEventHandler ("onResourceRestart", getRootElement (), wyszedl )
addEventHandler ("onResourceStop", getRootElement (), wyszedl )