Rol@ndy Posted June 5, 2014 Share Posted June 5, 2014 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) Link to comment
pa3ck Posted June 5, 2014 Share Posted June 5, 2014 Because the last player will never die. Check the number of alive players in your onPlayerWasted event and if it equals to 1, give the score and the money to the winner ( not source but the other alive player) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now