Simbad de Zeeman Posted January 14, 2008 Share Posted January 14, 2008 Hi, im having a problem with saving data into player accounts (accounts.xml) i use this simple test code function save ( source ) local playeraccount = getClientAccount ( source ) if ( playeraccount ) then save = setAccountData ( playeraccount, "test", "leukhe" ) if( save ) then outputChatBox ( "TEST: saved succesfull.", source , 66, 237, 251 ) else outputChatBox ( "TEST: didnt save... ", source , 66, 237, 251 ) end end end addCommandHandler ( "save", save ) when i type /save, it displays "TEST: saved succesfull." in the chat... but there is no data saved in my account Does someone maybe know whats the problem? or is it a bug Link to comment
Simbad de Zeeman Posted January 15, 2008 Author Share Posted January 15, 2008 Anybody? Link to comment
CJGrove Posted January 15, 2008 Share Posted January 15, 2008 This works.... function save ( source ) local playeraccount = getClientAccount ( source ) if ( playeraccount ) then leukhe = "leuk he" save = setAccountData ( playeraccount, "test", leukhe) if( save ) then outputChatBox ( "TEST: saved succesfull.", source , 66, 237, 251 ) else outputChatBox ( "TEST: didnt save... ", source , 66, 237, 251 ) end end end Link to comment
Simbad de Zeeman Posted January 15, 2008 Author Share Posted January 15, 2008 It doesn't edit: it does.. but strange... its just that it cant save strings or something but it returns true. edit 2: and setaccountdata doesnt work in event 'OnClientLogout' ( maybe a bug ? ) Link to comment
CJGrove Posted January 16, 2008 Share Posted January 16, 2008 Try something like this (taking money as an example) function save ( source ) local playeraccount = getClientAccount ( source ) if ( playeraccount ) then local playermoney = getPlayerMoney ( source ) save = setAccountData ( playeraccount, "money", playermoney) if( save ) then outputChatBox ( "TEST: saved succesfull.", source , 66, 237, 251 ) else outputChatBox ( "TEST: didnt save... ", source , 66, 237, 251 ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), save ) Link to comment
Simbad de Zeeman Posted January 16, 2008 Author Share Posted January 16, 2008 That was not my question ( i already made that though ) and i know what the problem was now so this topic comes to an end 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