Easy Checkpoints help.
#2

I'd suggest you using an array..
like:
pawn Код:
new Float:BCP[][3] =
{
    {x, y, z}, //coords of the 1. cp
    {x, y, z}, //coords of the 2. cp
    {x, y, z}, //coords of the 3. cp
    {x, y, z} //coords of the 4. cp  ....etc.
};
new pCP[MAX_PLAYERS];
now set the pCP (checkpoint variable) to -1 when the player connects ( = the player didn't start the mission yet
pawn Код:
public OnPlayerConnect(playerid)
{
    pCP[playerid] = -1;
}
then on your command
pawn Код:
pCP[playerid] = 0;
(get sure that the first coordinates (x, y, z) are the same coords as you've entered in the command)

and then for the checkpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(pCP[playerid] != -1)
    {
        GivePlayerMoney(playerid, 10);
        if(pCP[playerid] < sizeof(BCP))
        {
            pCP[playerid]++;
            SetPlayerCheckPoint(playerid, BCP[pCP[playerid]][0], BCP[pCP[playerid]][1], BCP[pCP[playerid]][2]);
        }
        else
        {
            SendClientMessage(playerid, 0x999999AA, "Route finished");
            DisablePlayerCheckpoint(playerid);
            pCP[playerid] = -1;
        }
    }
    return 1;
}
(not tested, just wrote it up)
Reply


Messages In This Thread
Easy Checkpoints help. - by ricardo178 - 10.06.2011, 17:23
Re: Easy Checkpoints help. - by Sascha - 10.06.2011, 17:32
Re: Easy Checkpoints help. - by ricardo178 - 10.06.2011, 17:40
Re: Easy Checkpoints help. - by ricardo178 - 10.06.2011, 17:47
Re: Easy Checkpoints help. - by sleepysnowflake - 10.06.2011, 17:50
Re: Easy Checkpoints help. - by Wesley221 - 10.06.2011, 17:51
Re: Easy Checkpoints help. - by Sascha - 10.06.2011, 17:52
Re: Easy Checkpoints help. - by ricardo178 - 10.06.2011, 18:02
Re: Easy Checkpoints help. - by Sascha - 10.06.2011, 18:08

Forum Jump:


Users browsing this thread: 1 Guest(s)