Jump to content

help with money saver


Recommended Posts

I've this code, but it needs to be logged in to save the money. But my server uses a different type of loggin. What can I do?

thanks

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) 
        else 
            outputChatBox("You have no cash in your bank. no money has been set!", source, 255, 0, 0) 
        end 
    end 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) 
addEventHandler("onPlayerLeave", getRootElement(), playerLeave) 

Link to comment
  
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 = getElementData(playercash, "cash",) 
        if (playerbank == true) then 
            setPlayerMoney(source, playerbank) 
        else 
            outputChatBox("You have no cash in your bank. no money has been set!", source, 255, 0, 0) 
        end 
    end 
end 
  
addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) 
addEventHandler("onPlayerLeave", getRootElement(), playerLeave) 
  

Don't use getAccountData use getElementData it will be easier. Try this it should work

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