All pastes #158134 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-01 23:38 UTC
rendered paste body
public FindHighestScore(){
        new Player_Score_Save = 0;
        new Player_Score_ID = 0;
        new Player_Score_ID2 = 0;
        new Player_Draw_Check = 0;
        new Player_Draw_Array[100] = 101;
        new Player_Draw_Array_Count = 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(Player_Score_ID != i){
                        if(IsPlayerConnected(i))
                        {
                                if (GetPlayerScore(i) == Player_Score_Save) {
                                        Player_Draw_Array[Player_Draw_Array_Count] = i;
                                        Player_Draw_Array_Count++;

                                        //Player_Score_ID2 = i; //No longer used - I BUMMED IT TO J00!
                                        Player_Draw_Check = 1;
                                }
                        }
                }
        }
        new str1[STR_LEN] = "";
        new str2[STR_LEN] = "";
        new strFirstName[MAX_PLAYER_NAME] = "";
        new strSecondName[MAX_PLAYER_NAME] = "";

        //Some array shit
        new strDrawArray[STR_LEN] = "";
        new strDrawPlayerName[MAX_PLAYER_NAME] = "";

        //We want a bigger size here, because were adding names in here :D (or thats the idea...)
        new strDrawArrayFinish[512] = "";
        if (Player_Draw_Check == 1) {
                for(new i=0; i<Player_Draw_Array_Count; i++)
                {
                        strDrawPlayerName = ReadPlayerName(Player_Draw_Array[i]);
                        format(str1, STR_LEN, "%s, %s", strDrawPlayerName, str1);
                }
                //strFirstName = ReadPlayerName(Player_Score_ID);
                //strSecondName = ReadPlayerName(Player_Score_ID2);
                format(str1, STR_LEN, "Players who won: %s", str1);
                SendClientMessageToAll(COLOR_YELLOW, str1);
        }
        if (Player_Draw_Check == 0) {
                strFirstName = ReadPlayerName(Player_Score_ID);
                format(str2, STR_LEN, "Player with the highest score: %s", strFirstName);
                SendClientMessageToAll(COLOR_YELLOW, str2);
        }
}