Jump to content

save wanted level on account


Recommended Posts

I want to save the player wanted level, but it doesn't work.can someone help me ? thanks.

function onQuit() 
    local acc = getPlayerAccount(source) 
    if not isGuestAccount(acc) then 
        local wantedLevel = getPlayerWantedLevel (source) 
        setAccountData(acc, "wlevel", wantedLevel) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onQuit) 
  
function onLogin(_, acc) 
    local acc = getPlayerAccount(source)
    local wantedLevel = getAccountData(acc, "wlevel") 
    setTimer (setPlayerWantedLevel,500,1,acc,wantedLevel)	
end 
addEventHandler("onPlayerLogin", getRootElement(), onLogin)

 

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