07.12.2016, 12:36
(
Последний раз редактировалось JaKe Elite; 10.12.2016 в 07:18.
)
SOLVED
I have been searching for a while now about this "Race Position" thing but I didn't find anything. How do I determine the player's position in the race or list the Top 5 Leading Players in the Race?
For these who are looking for answer, Use this code (modify it a little bit to fit your needs);
I have been searching for a while now about this "Race Position" thing but I didn't find anything. How do I determine the player's position in the race or list the Top 5 Leading Players in the Race?
For these who are looking for answer, Use this code (modify it a little bit to fit your needs);
PHP код:
stock GetPlayerRacePosition(playerid)
{
new count, cp = gCheckpoint[playerid];
foreach(new i : Character)
{
if(gCheckpoint[i] > gCheckpoint[playerid])
{
count ++;
}
else if (gCheckpoint[i] == gCheckpoint[playerid])
{
if (GetPlayerDistanceFromPoint(i, g_arrCheckpoints[cp][0], g_arrCheckpoints[cp][1], g_arrCheckpoints[cp][2]) < GetPlayerDistanceFromPoint(playerid, g_arrCheckpoints[cp][0], g_arrCheckpoints[cp][1], g_arrCheckpoints[cp][2]))
{
count ++;
}
}
}
return count + 1;
}