14.01.2012, 17:20
Do you mean, with a checkpoint?
For instance, I could have this:
For instance, I could have this:
pawn Код:
//Under OnGameModeInit()
SetTimer("CheckpointTimer", 1000, 1);
pawn Код:
//at the top of the script:
Following[MAX_PLAYERS];
BeingFollowed[MAX_PLAYERS];
pawn Код:
//Under on player connect:
Following[playerid] = 0;
BeingFollowed[playerid] = 0;
pawn Код:
command(follow, playerid, params[])
{
new id;
if(sscanf(params, "u", id)) return SendClientMessage(playerid, GREY, "Server: /follow [playerid/name]");
{
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerCheckpoint(playerid, x, y, z, 5);
Following[playerid] = 1;
BeingFollowed[id] = 1;
}
return 1;
}
pawn Код:
Above the command:
forward CheckpointTimer();
public CheckpointTimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(BeingFollowed[i] == 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(i, x, y, z);
if(Following[i] == 1)
{
SetPlayerCheckpoint(i, x, y, z, 5);
}
}
}
return 1;
}