DM game, most kills wins... But what about when its a draw...
#1

I've made a DM script, the winner is the one with the most kills..

Though, if theres 2 players who have both killed the same amount of players.. The player with the lowest id would win..

So id 5 has 10 kills, id 6 has 10 kills. id 5 would be declared the winner...

How can i do a check, so if players have killed the same amount of players each, it would be declared as a draw, and the prize money split between them?
Reply
#2

i think i would do:
pawn Код:
public GetWinners()
{
new highestkill = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Kills[i] > highestkill) highestkill = Kills[i];
}
new winnercount = 0;
for(new p = 0; p < MAX_PLAYERS; p++)
{
if(Kills[p] == highestkill)
{
Winner[p] = 1;
winnercount++;
}
}
new prize = cashprize/winnercount;
for(new a = 0; a < MAX_PLAYERS; a++)
{
if(Winner[a]) GivePlayerMoney(a,prize);
}
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
Kills[killerid] ++;
return 1;
}
Reply


Forum Jump:


Users browsing this thread: