Top kills,deaths,score - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Top kills,deaths,score (
/showthread.php?tid=515717)
Top kills,deaths,score -
DavidBilla - 27.05.2014
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];
Re: Top kills,deaths,score -
R0 - 27.05.2014
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
}
}
Re: Top kills,deaths,score -
DavidBilla - 27.05.2014
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?
Re: Top kills,deaths,score -
R0 - 27.05.2014
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
}
}