All pastes #158076 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-09-01 23:08 UTC
rendered paste body
public FindHighestScore(){
        new Player_Score_Save = 0;
        new Player_Score_ID = 0;
        new Player_Score_ID2 = 0;
        for(new i=0; i<MAX_PLAYERS; i++)
        {
                if(IsPlayerConnected(i))
                {
                        if (GetPlayerScore(i) > Player_Score_Save) {
                                Player_Score_Save = GetPlayerScore(i);
                                Player_Score_ID = i;
                        }
                }
        }
        Player_Score_ID2 = 101;
        for(new i=0; i<MAX_PLAYERS; i++)
        {
                if(IsPlayerConnected(i))
                {
                        if (GetPlayerScore(i) == Player_Score_Save) {
                                Player_Score_ID2 = i;
                        }
                }
        }
        new str1[STR_LEN] = "";
        new str2[STR_LEN] = "";
        new strFirstName[MAX_PLAYER_NAME] = "";
        new strSecondName[MAX_PLAYER_NAME] = "";
        strFirstName = ReadPlayerName(Player_Score_ID);
        strSecondName = ReadPlayerName(Player_Score_ID2);
        if !(Player_Score_ID2 = 101) {
                format(str1, STR_LEN, "Players with the highest score: %s %s", strFirstName, strSecondName);
                SendClientMessageToAll(COLOR_YELLOW, str1);
        }else{
                format(str2, STR_LEN, "Player with the highest score: %s", strFirstName);
                SendClientMessageToAll(COLOR_YELLOW, str2);
        }
}