Its Race system.
The "Final Survivor" not get stats (cash,points)!
Pls Help!
function earnMoney()
local thePlayer = source
local position = (getAliveRacePlayers() + 1)
local account = getPlayerAccount(thePlayer)
if not (isGuestAccount(account)) then
if getPlayerCount() >= 3 then
local pAlive = getAliveRacePlayers()
local pDead = getDeadRacePlayers()
local finalCash = 0
if not (position == 1) then
if pAlive == 0 then pAlive = 1 end
if not respawnFix[thePlayer] then
local finalCash = math.floor(((40/position)*pDead)*pAlive) -- Calculate the final money value.
local points = math.floor((pAlive + pDead)*pDead)
local playerCash = getAccountData(account,"cash")
local playerPoints = getAccountData(account,"points")
setAccountData(account,"points",playerPoints+points)
setAccountData(account,"cash",playerCash+finalCash)
local playerCash = getAccountData(account,"cash")
local playerPoints = getAccountData(account,"points")
addStat(account,"totalDeaths",1)
outputChatBox("#00BFFF[FINISHED] #FFFFFFYou have received $#00BFFF" .. finalCash .. " #ffffff and #00BFFF"..points.."#ffffff EXP for#00BFFF "..position.." #ffffffplace!",thePlayer,255,255,255,true)
respawnFix[thePlayer] = true
end
end
else
outputChatBox("#00BFFF[FINISHED] #FFFFFFNot enough players to earn money - #00BFFF3 #FFFFFFrequired.",thePlayer,255,255,255,true)
return
end
scoreboardRefresh(thePlayer)
end
end
addEventHandler ("onPlayerWasted",getRootElement(),earnMoney)