Top kills,deaths,score
#1

Well i'm new to pawn scripting,only today i learnt how to add kills and deaths to players.
Now i want to make a textdraw showing the top kills,deaths and scores of a certain amount of players.
I searched the help archive and couldn't find anything simple.
hoping someone could help me with creating this top list thing.
Btw i dont need entire code but only the part which gives an explanation of how it is done.

This is how i declared the kills and deaths
PHP код:
new Kills[MAX_PLAYERS];
new 
Deaths[MAX_PLAYERS]; 
Reply
#2

Use textdraws to make one and set the string of it to the top kills,to get the top kills use:
pawn Код:
new topkills = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
        if(Kills[i] > topkills)
        {
               topkills = Kills[i]; //and set the string if the textdraw to topkills
        }
}
Reply
#3

Btw how will you be able to get the name of the player who got the top kill and display it when a command is used?
Reply
#4

pawn Код:
new topkills = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
        if(Kills[i] > topkills)
        {
               topkills = Kills[i]; //and set the string if the textdraw to topkills
               new name[MAX_PLAYER_NAME+1];
               GetPlayerName(playerid, name, sizeof(name));
               //here update the textdraw to make the name the player's name
        }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)