I may be mistaken but I think you can't have 2 functions named the same
Either have everything in onPlayerJoin and onPlayerQuit or name the functions different
Example for naming the functions different:
function onPlayerQuitSaveMoney ( )
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
local playermoney = getPlayerMoney ( source )
setAccountData ( playeraccount, "mtafreeroam.money", playermoney )
end
end
function onPlayerJoinLoadMoney ( )
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
local playermoney = getAccountData ( playeraccount, "mtafreeroam.money" )
if ( playermoney ) then
setPlayerMoney ( source, playermoney )
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuitSaveMoney )
addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoinLoadMoney )
--
function onPlayerQuitSavePosition ( )
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
local playerposition = getElementPosition ( source )
setAccountData ( playeraccount, "mtafreeroam.position", playerposition )
end
end
function onPlayerJoinLoadPosition ( )
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) then
local playerposition = getAccountData ( playeraccount, "mtafreeroam.position" )
if ( playerposition ) then
setElementPosition ( source, playerposition )
end
end
end
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuitSavePosition )
addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoinLoadPosition