Another problem. The data isn't saving when the resource stops or the client logs out.
addEventHandler("onPlayerLogout", root, function(acc)
local timer = getElementData ( source , "timer:onlineTime" )
if isTimer ( timer ) then
killTimer ( timer )
end
setElementData(source, "Online Time", "0 minutes")
setAccountData(acc, "Online Time", getElementData(source, "Online Time"))
end)
addEventHandler("onResourceStop", root,
function()
local players = getElementsByType("player")
for i,v in ipairs(players) do
setAccountData(getPlayerAccount(v), "Online Time", getElementData(v, "Online Time"))
end
end)