Jump to content

help please


Recommended Posts

hey all this not my code work  but  when i do shut down\ and iem running my sever money= 0 can help me

 

 

 

 

function playerQuit() 
    local playerAcc = getPlayerAccount(source) 
    if ( playerAcc  ) then -- You we're checking if (playeraccount == true) then, but your variable name is "playeracc". 
        local playerCash = getPlayerMoney(source) 
        setAccountData(playerAcc, "cash", playerCash) 
        setPlayerMoney(source, 0) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), playerQuit) 
addEventHandler("onPlayerLogout", getRootElement(), playerQuit) 
  
function playerLogin() 
    local playerAcc = getPlayerAccount(source) 
    if (playerAcc) then 
        local playerBank = getAccountData(playerAcc, "cash") 
        if (playerBank) then 
            setPlayerMoney(source, tonumber(playerBank)) 
        else 
            outputChatBox("You are broke.", source, 255, 0, 0) 
        end 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), playerLogin)

 

Edited by ايهاب
Link to comment
1 hour ago, Erlkonig said:

Is it works when the player leaving the server before restart / shutdown?
Did you check the value in database when the player has leaved the server?

restart  and shutdown= money 0

 

I cannot edit, I am not a programmer
Is there anything that saves that? mood

 
 
 
 
 
 
 
 
 
 
 
 
 
Edited by ايهاب
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...