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) 
addEventHandler("onPlayerQuit", getRootElement(), onQuit) 
function onLogin(_, acc) 
    local acc = getPlayerAccount(source)
    local wantedLevel = getAccountData(acc, "wlevel") 
    setTimer (setPlayerWantedLevel,500,1,acc,wantedLevel)	
addEventHandler("onPlayerLogin", getRootElement(), onLogin)


Share this post

Link to post

Easy mistake. You're applying the wanted level to the wrong element (to the account instead of the player)

Line 13 should be

setTimer (setPlayerWantedLevel,500,1,source,wantedLevel)


  • Thanks 1

Share this post

Link to post

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.