Jump to content

does not make money first player


JoZeFSvK

Recommended Posts

hey i have problem all players recieved cash and first nothing

function earnMoney(thePlayer) 
    local position = getAliveRacePlayers() 
    if not (position <= 0) then 
        if getPlayerCount() >= 3 then 
            local pAlive = getAliveRacePlayers() 
            local pDead = getDeadRacePlayers() 
  
            local maxCash = 21*(pAlive+pDead)    
            local portion = 0 
            local finalCash = 0 
  
            if not (position == 1) then 
                portion = math.ceil(maxCash/(pAlive+pDead-1))       
                finalCash = math.ceil(portion*(pDead))     
            else 
                finalCash = maxCash 
            end 
            local playerCash = loadPlayerData(thePlayer,"cash") 
            outputChatBox("#0095FF* #FFFFFFYou have recieved $" .. finalCash .. "!",thePlayer,255,255,255,true) 
            savePlayerData(thePlayer,"cash",playerCash +finalCash) 
            outputDebugString("Final cash for player "..getPlayerName(thePlayer)..": "..finalCash) 
            totalMoneyEarnedAdd(thePlayer,finalCash,finalCash) 
        else 
            outputChatBox("#0095FF* #FFFFFFNot enough players to earn money - #ABCDEF3 #FFFFFFrequired.",thePlayer,255,255,255,true) 
            return 
        end 
        scoreboardRefresh(thePlayer) 
        refreshStats(thePlayer) 
        progressBarUpdate(thePlayer) 
        totalMoneyAchievements(thePlayer) 
    end 
end 
  
  
  
  

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