Jump to content

Crear Sistema Lvl ?


Recommended Posts

onPlayerLogin

setAccountData

setTimer

El algoritmo seria sensillo, algo asi

function onPlayerLogin (_, playeraccount ) 
    local lvl = getAccountData ( playeraccount, "lvl" ) or 1 
    local toNextLvl = 10 * lvl 
    local progress = getAccountData ( playeraccount, "progress" ) or 0 
    setTimer ( function() 
        progress = progress + 1 
        if progress == toNextLvl then 
            lvl = 2 
            setAccountData ( playeraccount, "lvl", lvl ) 
            toNextLvl = toNextLvl * lvl 
            progress = 0 
        end 
        setAccountData ( playeraccount, "progress", progress ) 
    end, 3600000, 0 ) 
end 
addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) 

Link to comment
  • Recently Browsing   0 members

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