12.07.2010, 07:34
pawn Код:
new winners[3] ={INVALID_PLAYER_ID,INVALID_PLAYER_ID,INVALID_PLAYER_ID};
for(new i=0;i<MAX_PLAYERS;i++){
if(!IsPlayerConnected(i))continue;
if(KILLS[i] > KILLS[winners[0]])winners[0]=i;
}
for(new i=0;i<MAX_PLAYERS;i++){
if(winners[0] == INVALID_PLAYER_ID)break;
if(!IsPlayerConnected(i))continue;
if(i == winners[0])continue;
if(KILLS[i] > KILLS[winners[1]])winners[1]=i;
}
for(new i=0;i<MAX_PLAYERS;i++){
if(winners[0] == INVALID_PLAYER_ID || winners[1] == INVALID_PLAYER_ID)break;
if(!IsPlayerConnected(i))continue;
if(i == winners[0] || i == winners[1])continue;
if(KILLS[i] > KILLS[winners[2]])winners[2]=i;
}
if(winners[0] == INVALID_PLAYER_ID)print("no winners");
else if(winners[1] == INVALID_PLAYER_ID)printf("1st = %d",winners[0];
else if(winners[2] == INVALID_PLAYER_ID)printf("1st = %d : 2nd = %d",winners[0],winners[1];
else printf("1st = %d : 2nd = %d : 3rd = %d",winners[0],winners[1],winners[2]);//playerid of winner