22.06.2011, 06:32
(
Последний раз редактировалось Kitten; 24.11.2013 в 06:09.
)
Solved
#include <a_samp>
#include <foreach>
main() {
}
new
PlayerRace[MAX_PLAYERS], // so you can have multiple races at once
PlayerRaceCheckpoint[MAX_PLAYERS];
public OnPlayerEnterCheckpoint(playerid) {
if(PlayerRace[playerid] > 0) {
PlayerRaceCheckpoint[playerid]++;
new
iCount;
foreach(Player, i) {
if(PlayerRaceCheckpoint[i] >= PlayerRaceCheckpoint[playerid])
iCount++;
}
// iCount holds the position that they're in.
}
return 1;
}
stock initRace(playerid) {
// do whatever checks you need here.
PlayerRace[playerid] = 1; // raceid, you might want to fiddle around with this
PlayerRaceCheckpoint[playerid] = 0;
}
Assuming you want to just use OnPlayerEnterCheckpoint, you could track a variable which determine what checkpoint number they're at, and in the callback you could perform a loop to see who is at or has passed that checkpoint, then add up a number of players who've passed the checkpoint already, and +1 to that number, then that should be their place?
pawn Код:
|
//OnPlayerEnterCheckpoint
new
iCount;
foreach(Player, i) {
if(PlayerRaceCheckpoint[i] >= PlayerRaceCheckpoint[playerid])
iCount++;
}
PlayerRaceCheckpoint[playerid]++;