Clipper_ Posted December 15, 2014 Share Posted December 15, 2014 Hello here! I need some help. I need an advice. If I replace "gabriell" with "thePlayer" is the money saving for each player and not for my account? function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local playermoney = getPlayerMoney ( source ) -- get the player money setAccountData ( playeraccount, "piraterpg.money", playermoney ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) -- when a player logins, retrieve his money amount from his account data and set it if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "piraterpg.money" ) -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playermoney ) then setPlayerMoney ( source, playermoney ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) I wanna modify this script to convert it for a stat save (got a problem with this script) Link to comment
tosfera Posted December 15, 2014 Share Posted December 15, 2014 It is currently saving for all the accounts, nothing wrong with this. And I can't see this "gabriell" anywhere haha. Link to comment
Clipper_ Posted December 15, 2014 Author Share Posted December 15, 2014 In Wiki, there is a "piraterpg.money" and i though it is a acc name. anyway thx Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now