Hello here! I need help in something
function savePlayerData (thePlayer)
if not (isGuestAccount (getPlayerAccount (source))) then
local playeraccount = getPlayerAccount
if ( playeraccount ) then
local isPlayerInClass = getPlayerTeam( source )
if ( ( isPlayerInClass ) and not isGuestAccount( account ) ) then
setAccountData(playeraccount, "save.Player.Class", getTeamName( isPlayerInClass ))
end
end
end
end
addEventHandler("onPlayerQuit", root, savePlayerData);
addEventHandler("onPlayerLogout", root, savePlayerData);
function loadPlayerData ()
if not (isGuestAccount (getPlayerAccount (source))) then
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
local isPedInClass = getAccountData (playeraccount, "save.Player.Class")
if ( ( isPedInClass ) and getTeamFromName( isPedInClass ) ) then
setPlayerTeam(source, getTeamFromName( isPedInClass ))
end
end
end
end
addEventHandler("onPlayerLogin", root, loadPlayerData)
addEventHandler ("onPlayerLogin",root,
function()
loadStats( getPlayerAccount(source))
end
)
addEventHandler ("onPlayerQuit",root,
function()
saveStats( getPlayerAccount(source))
end
)
addEventHandler ("onPlayerLogout",root,
function()
saveStats( getPlayerAccount(prev))
end
)
addEventHandler ("onPlayerWasted",root,
function()
loadStats( getPlayerAccount(source))
end
)
function saveStats( Acc)
for i = 69 , 79 do
setAccountData(Acc, "stat."..i , getPedStat(source,i))
end
end
function loadStats(Acc )
for i = 69 , 79 do
setPedStat(source,i,getAccountData(Acc, "stat."..i))
end
end
Can you help me with some lines for saving the stats after dying? I mean, stats are to basic value after the ped is dead.
And i can't figure out how to save them.
I tried something in lines 43 - 49, but effect is same (basic stats after ped is dead)
Sorry for my english!
Leave here a messaje if you all have a solution.
Thanks!