10.06.2011, 17:32
I'd suggest you using an array..
like:
now set the pCP (checkpoint variable) to -1 when the player connects ( = the player didn't start the mission yet
then on your command
(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:
(not tested, just wrote it up)
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];
pawn Код:
public OnPlayerConnect(playerid)
{
pCP[playerid] = -1;
}
pawn Код:
pCP[playerid] = 0;
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;
}

