MasterTobi Posted November 22, 2008 Share Posted November 22, 2008 Hey, if i use the getaccountdata and setaccountdata from wiki then i go on my server an use /register and /login they create my account to account.acl. close Mta. Then i edit account.acl piraterpg.money=100 save it Open Mta and login to my server /login the money is always still 0 i dont no why can you help me? or it gives a resource where create accounts whit data, /login, /register ? THX p.s.my English is bad Link to comment
robhol Posted November 22, 2008 Share Posted November 22, 2008 /login and /register are already there. For account data, you can't modify it while the server is running. Link to comment
MasterTobi Posted November 22, 2008 Author Share Posted November 22, 2008 yes i know i closed the server always then i edit account.acl Link to comment
DakiLLa Posted November 22, 2008 Share Posted November 22, 2008 For account data, you can't modify it while the server is running. but you can make a check, if account of any player is not guest, and then do what you want to do with accounts. something like this: save player money when he leaves a server. And it's work great for me i dont have any problems with deleting accounts. And dont use names of keys like "rpg.money" it deletes accounts too. I dont know why, so, use usual names of keys, like in my example. local account = getClientAccount ( source ) local guest = isGuestAccount ( account ) if ( guest ) then outputDebugString ( "*" ..getClientName ( source ).. " has left server with guest account." ) else --Money local money = getPlayerMoney ( source ) if ( money ) then setAccountData ( account, "money", money ) outputDebugString ( "*" ..getClientName ( source ).. " has left server. Saving his data..OK!" ) end end Link to comment
MasterTobi Posted November 22, 2008 Author Share Posted November 22, 2008 hmhmhmhmhmhm i changed it now, but if I log in he does not take over it from that account.acl function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getClientAccount ( source ) if ( playeraccount ) then local playermoney = getPlayerMoney ( source ) setAccountData ( playeraccount, "money", playermoney ) end end function onPlayerJoin ( ) -- when a player joins, retrieve his money amount from his account data and set it local playeraccount = getClientAccount ( source ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "money" ) if ( playermoney ) then setPlayerMoney ( source, playermoney ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin ) this does not function someone can help me Link to comment
eXo|Flobu Posted November 23, 2008 Share Posted November 23, 2008 the money must set when a player login not when he join function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getClientAccount ( source ) -- check if the account is a guest account or not if not isGuestAccount( playeraccount ) then local playermoney = getPlayerMoney ( source ) local suc = setAccountData ( playeraccount, "money", playermoney ) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) function onPlayerLogin ( ) -- when a player login, retrieve his money amount from his account data and set it local playeraccount = getClientAccount ( source ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "money" ) if ( playermoney ) then setPlayerMoney ( source, playermoney ) end end end addEventHandler ( "onClientLogin", getRootElement ( ), onPlayerLogin ) 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