25.01.2015, 18:33
Hi guys,
How do I make the ranking of players in racing?
For Example:
1. Peter
2. Bear
How do I make the ranking of players in racing?
For Example:
1. Peter
2. Bear
switch(win)
{
case 0:
{
win++;
//player has won the race
}
case 1:
{
win++;
//player is second
}
case 2:
{
win++;
//player is third
}
Create a global variable such as "win = 0;" then in the final checkpoint create a switch:
pawn Код:
|
I have no idea what you wrote in that code.
Sorting an array which contains all players with quicksort would be a good idea: http://forum.sa-mp.com/showpost.php?...postcount=1737 |
new Ranking[3];// arrays contained are 0 1 2
switch(win)
{
new name[24];
GetPlayerName(playerid,name,sizeof name);
case 0:
{
win++;
Ranking[0] = name;
//player has won the race
}
case 1:
{
win++;
Ranking[1] = name;
//player is second
}
case 2:
{
win++;
Ranking[2] = name;
//player is third
}
}