All pastes #158312 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-02 02:21 UTC
rendered paste body
public FindHighestScore(){
        new Player_Score_Save = 0;
        new Player_Score_ID = 0;
        new Player_Score_ID2 = 0;
        new Player_Score_ID3 = 0;
        new Player_Draw_Check = 0;
        new Player_Has_A_Score = 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_Has_A_Score = 1;
                        }
                }
        }
        if(Player_Has_A_Score == 1)
        {
        Player_Score_ID2 = 101;
        for(new i=0; i<MAX_PLAYERS; i++)
        {
                if(Player_Score_ID != i){
                if(IsPlayerConnected(i))
                {
                        if (GetPlayerScore(i) == Player_Score_Save) {
                                Player_Score_ID2 = i;
                                Player_Draw_Check = 1;
                        }
                }
                }
        }
        Player_Score_ID3 = 101;
        for(new i=0; i<MAX_PLAYERS; i++)
        {
                if(Player_Score_ID2 != i){
                if(IsPlayerConnected(i))
                {
                        if (GetPlayerScore(i) == Player_Score_Save) {
                                Player_Score_ID3 = i;
                                Player_Draw_Check = 2;
                        }
                }
                }
        }
        
        new str1[STR_LEN] = "";
        new str2[STR_LEN] = "";
        new str3[STR_LEN] = "";
        new strFirstName[MAX_PLAYER_NAME] = "";
        new strSecondName[MAX_PLAYER_NAME] = "";
        new strThirdName[MAX_PLAYER_NAME] = "";
        if (Player_Draw_Check == 1) {
                strFirstName = ReadPlayerName(Player_Score_ID);
                strSecondName = ReadPlayerName(Player_Score_ID2);
                format(str1, STR_LEN, "Players with the highest score: %s %s", strFirstName, strSecondName);
                SendClientMessageToAll(COLOR_YELLOW, str1);
        }
        if (Player_Draw_Check == 2) {
                strFirstName = ReadPlayerName(Player_Score_ID);
                strSecondName = ReadPlayerName(Player_Score_ID2);
                strThirdName = ReadPlayerName(Player_Score_ID3);
                format(str2, STR_LEN, "Players with the highest score: %s %s %s", strFirstName, strSecondName, strThirdName);
                SendClientMessageToAll(COLOR_YELLOW, str2);
        }
        if (Player_Draw_Check == 0) {
                strFirstName = ReadPlayerName(Player_Score_ID);
                format(str3, STR_LEN, "Player with the highest score: %s", strFirstName);
                SendClientMessageToAll(COLOR_YELLOW, str3);
        }
        }else{
SendClientMessageToAll(COLOR_YELLOW, "no 1 has > 0 yet!");
        }
}