How to make something like this
#2

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 Код:
#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;
}
Reply


Messages In This Thread
How to make something like this - by Kitten - 22.06.2011, 06:32
Re: How to make something like this - by Calgon - 22.06.2011, 08:37
Re: How to make something like this - by [BP]Tony - 22.06.2011, 08:58
AW: How to make something like this - by Nero_3D - 22.06.2011, 10:18

Forum Jump:


Users browsing this thread: 1 Guest(s)