Return the 3 top scoring
#7

Thanks to nero for this code it works perfectly but no i need to update the textdraws any idea how i can do this? this is what i have at the minute

Code:
	GetPlayerName(WinningPlayers[0][0],PlayerInfo[WinningPlayers[0][0]][pName],MAX_PLAYER_NAME);
	format(string, sizeof(string), "%s(%d)", PlayerInfo[WinningPlayers[0][0]][pName],PlayerInfo[WinningPlayers[0][1]]);
	TextDrawSetString(FirstPlace,string);
	TextDrawShowForAll(FirstPlace);
Code:
GetHighScorePlayers(array[MAX_PLAYERS][2]) {
    // and we store the playerid and the score in the array
    foreach(new i : Player) {
        array[i][0] = i;
        array[i][1] = PlayerInfo[i][pScore];
    }
    // now we just sort the whole array descending by the value stored in [1] (the score)
    SortDeepArray(array, 1, .order = SORT_DESC);
}
Code:
    new
        tPlayer[MAX_PLAYERS][2]
    ;
    GetHighScorePlayers(tPlayer);

    printf("1. %d Score: %d", tPlayer[0][0], tPlayer[0][1]);
    printf("2. %d Score: %d", tPlayer[1][0], tPlayer[1][1]);
    printf("3. %d Score: %d", tPlayer[2][0], tPlayer[2][1]);
Reply


Messages In This Thread
Return the 3 top scoring - by Kontrol - 04.05.2014, 01:10
Re: Return the 3 top scoring - by superrobot48 - 04.05.2014, 03:29
Re: Return the 3 top scoring - by Kontrol - 04.05.2014, 10:25
AW: Return the 3 top scoring - by Nero_3D - 04.05.2014, 10:39
Re: AW: Return the 3 top scoring - by Kontrol - 04.05.2014, 11:26
Re: Return the 3 top scoring - by XK - 04.05.2014, 11:40
Re: Return the 3 top scoring - by Kontrol - 04.05.2014, 12:32
AW: Re: Return the 3 top scoring - by Nero_3D - 04.05.2014, 13:33

Forum Jump:


Users browsing this thread: 1 Guest(s)