Quote:
Originally Posted by admantis
This would require only a bit of logical thinking.
pawn Code:
new richest = INVALID_PLAYER_ID; new amount = 0;
for(new p = 0; p < MAX_PLAYERS; p ++) { if(GetPlayerMoney(p) > GetPlayerMoney(richest) || richest == INVALID_PLAYER_ID) { amount = GetPlayerMoney(p); richest = p; } } printf("The richest player is %d with $%d", richest, amount);
|
Little note if using 0.3.7: Using MAX_PLAYERS in loops is outdated in 0.3.7. GetPlayerPoolSize() is to be used.