Jump to content

(AYUDA) Savesystem money


sNacks

Recommended Posts

tengo un save system que guarda dinero , skin , armas y team... el de dinero y el de skin no me estan funcionando.. me tira error en la linea 17..  (la dejo en rojo para que la vean)  no se como arreglarlo -.- 

 

function saveMoney()
    local money = getPlayerMoney(source)
    if tonumber(money) < 0 then
        return    
    else
        setElementData(source,'money', money)
    end
end
addEventHandler('onPlayerWasted',root, saveMoney)

function giveMoney()
    local account = getPlayerAccount(source)
    if isGuestAccount(account) then
        return
    else
        local money = getElementData(source,'money')
        if tonumber(money) > 0 then
            givePlayerMoney(source,tonumber(money))
        else
            return
        end
    end
end
addEventHandler('onPlayerSpawn',root, giveMoney)


function saveMoneyQuit() 
    local money = getPlayerMoney(source)
    
    if tonumber(money) < 0 then
        return    
    else
        local account = getPlayerAccount(source)
        setAccountData(account,'save.Money',money)
    end
end
addEventHandler('onPlayerQuit',root,saveMoneyQuit)

function saveMoneyQuit() 
    local account = getPlayerAccount(source)
    local money = getAccountData(account,'save.Money')
    if tonumber(money) < 0 then
        return    
    else
        givePlayerMoney(source,tonumber(money))
    end
end
addEventHandler('onPlayerLogin',root,saveMoneyQuit)

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