Jump to content

Getting accountData on login


audi868

Recommended Posts

Hi,

I am making a kills/deaths save script on accountData and I want to retrieve the kills/deaths on login but it is not working in proper way, i.e it does not loads the kills/deaths on login

here is my code,

root = getRootElement() 
  
addEventHandler("onPlayerLogin",root,function(account) 
    local kills = getAccountData(account,"kills") 
    local deaths = getAccountData(account,"deaths") 
    if not (deaths and kills) then return end 
    setElementData(source,"kills",kills) 
    setElementData(source,"deaths",deaths) 
    outputDebugString("Player score set") 
    end 
) 

Link to comment
root = getRootElement() 
  
addEventHandler("onPlayerLogin",root,function(_, account) 
    local kills = getAccountData(account,"kills") 
    local deaths = getAccountData(account,"deaths") 
    if not (deaths and kills) then return end 
    setElementData(source,"kills",kills) 
    setElementData(source,"deaths",deaths) 
    outputDebugString("Player score set") 
    end 
) 

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...