Jump to content

saving and loading


Fantanic

Recommended Posts

Like this? or do i have to add the setwantedlevel or?

function savewanted() 
local user = getPlayerFromName(player) 
getElementData(user,"wanted") 
local playeraccount = getPlayerAccount ( source ) 
setAccountData ( playeraccount, "wanted", wanted ) 
end 
addEventHandler("onPlayerQuit", getRootElement(), savewanted) 
  
function loadwanted (_, playeraccount) 
local playerAccount = getPlayerAccount(source) -- get his account 
if ( playerAccount ) then 
local wanted = getAccountData(playerAccount, "wanted") 
if (wanted) then 
end 
end 
end 
addEventHandler("onPlayerLogin", getRootElement(), loadwanted) 

Link to comment
function savewanted() 
    local playeraccount = getPlayerAccount(source) 
    if playeraccount and not isGuestAccount(playeraccount) then 
        local wanted = getElementData(source, "wanted") 
        if wanted then 
            setAccountData(playeraccount, "wanted", wanted) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), savewanted) 
  
function loadwanted(_, playeraccount) 
    local wanted = getAccountData(playerAccount, "wanted") 
    if (wanted) then 
        setElementData(source, "wanted", wanted) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), loadwanted) 

Link to comment

Thanks it works but is it posible to add a exported function for setting the wantedlevel?

Cause im using it if ur wanted the stars get up but now u only see it in tab that u are wanted.(it works it detects ur wanted but the stars arent coming up)

example :

function savewanted() 
    local playeraccount = getPlayerAccount(source) 
    if playeraccount and not isGuestAccount(playeraccount) then 
        local wanted = getElementData(source, "wanted") 
        if wanted then 
            setAccountData(playeraccount, "wanted", wanted) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), savewanted) 
  
function loadwanted(_, playeraccount) 
    local wanted = getAccountData(playeraccount, "wanted") 
    if (wanted) then 
        setElementData(source, "wanted", wanted) 
    end 
    setPlayerWanted(source,amount) 
end 
addEventHandler("onPlayerLogin", getRootElement(), loadwanted) 

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