Jump to content

SetAccountData problem


Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...