Witam. Mam taki problem, ot?? przerabia?em m?j stary system respektu na system g?odu i natrafi?em na problem. Gdy odpal? skrypt to jest dobrze bo usuwa 1 punkt w minut?, ale drugi raz ju? nie usunie. po 100 ustawia na 99 i dalej ju? si? nie ruszy. Wiecie o co chodzi? Przecie? setTimer jest ustawiony na niesko?czono?? razy
A przy okazji mo?esz mi jeszcze poprawi? zapis? Bo jak wyjd? i wejd? to mam znowu 100 g?odu
function odczyt ()
local konto = getAccountName(getPlayerAccount(source))
local data = getAccountData(konto, "Respekt")
if data then
setElementData(source, "Respekt", data)
else
setAccountData(konto, "Respekt", 100)
setElementData(source, "Respekt", 100)
end
end
addEventHandler ( 'onPlayerLogin', getRootElement (), odczyt)
function zapis ()
local konto1 = getPlayerAccount(source)
local data1 = getElementData(source, "Respekt")
if data1 then
setAccountData(konto1, "Respekt", data1)
end
end
addEventHandler( "onPlayerQuit", getRootElement(), zapis)
addEventHandler( "onPlayerLogout", getRootElement(), zapis)
addEventHandler( "onResourceStop", getRootElement(), zapis)
function odczyt ( _, konto )
local data = getAccountData(konto, "Respekt")
if data then
setElementData(source, "Respekt", data)
else
setAccountData(konto, "Respekt", 100)
setElementData(source, "Respekt", 100)
end
end
addEventHandler ( 'onPlayerLogin', getRootElement (), odczyt)
function zapis (_,konto)
setAccountData(konto, "Respekt", (getElementData(source, "Respekt")or 100))
end
addEventHandler( "onPlayerLogout", getRootElement(), zapis)
function zapis2 ()
setAccountData(getPlayerAccount(source), "Respekt", (getElementData(source, "Respekt")or 100))
end
addEventHandler( "onPlayerQuit", getRootElement(), zapis2)
A co do marker?w:
addEventHandler("onMarkerHit", wyjscie2, function(el, md)
if isPedInVehicle(el) then return end
if not md then return end
setElementDimension (el, 0)
setElementInterior (el, 0)
setElementPosition (el, -2358.87769, 1007.62817, 50.69531)
end)
Ostatnio zmieniony przez #404 2015-10-04, 22:01, w całości zmieniany 1 raz
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