Jump to content

Porque no funciona ?


iFoReX

Recommended Posts

Porque el $ no se guarda ?

function playerLeave() 
    local playeracc = getPlayerAccount(source) 
    if ( playeraccount == true ) then 
        local playercash = getPlayerMoney(source) 
        setAccountData(playeracc, "cash", playercash) 
    end 
end 
  
function playerReJoin() 
    local playeracc = getPlayerAccount(source) 
    if (playeracc == true) then 
        local playerbank = getAccountData(playeracc, "cash") 
        if (playerbank == true) then 
            setPlayerMoney(source, playerbank) 
        end 
    end 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) 
addEventHandler("onPlayerLeave", getRootElement(), playerLeave) 

Link to comment
function playerLeave() 
    local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        local playercash = getPlayerMoney(source) 
        setAccountData(playeracc, "cash", playercash) 
    end 
end 
  
function playerReJoin() 
    local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        local playerbank = getAccountData(playeracc, "cash") 
        if (playerbank) then 
            setPlayerMoney(source, playerbank) 
        end 
    end 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) 
addEventHandler("onPlayerQuit", getRootElement(), playerLeave) 

Revisa 'onPlayerLeave' y veras su bajo nivel de existencia.

Tambien usabas 'playeraccount' cuando tu variable es 'playeracc'

Edited by Guest
Link to comment
1: Estas verificando si 'playeracc' es igual a 'true', pero no va a ser igual, porque va a devolver una cuenta.

2: Estas verificando si 'playerbank' es igual a 'true', pero si tiene algo guardado, va a ser un numero.

Solo por duda, verificarlo asi:

    if (playeracc) then 

Debería servir, verdad?

Link to comment
Entonces como uquedaria el script ?

Como te lo Postee al principio:

function playerLeave() 
    local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        local playercash = getPlayerMoney(source) 
        setAccountData(playeracc, "cash", playercash) 
    end 
end 
  
function playerReJoin() 
    local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        local playerbank = getAccountData(playeracc, "cash") 
        if (playerbank) then 
            setPlayerMoney(source, playerbank) 
        end 
    end 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) 
addEventHandler("onPlayerQuit", getRootElement(), playerLeave) 

Link to comment
  • Recently Browsing   0 members

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