Quote:
Originally Posted by CSLangdale
Код:
CMD:bk(playerid,params[])
{
new string[128], Float:X, Float:Y, Float:Z;
if(pInfo[playerid][Faction] == 1)
{
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "(Police Radio): %s is requesting backup at his position.", GetName(playerid));
PoliceBroadcast(COLOR_DARKBLUE,string,1);
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(pInfo[i][Faction] == 1)
{
SetPlayerCheckpoint(i, X, Y, Z, 3.0);
BackupCP[playerid] = 1;
}
}
}
return 1;
}
Can anyone tell me how to change this so that the checkpoint moves with the player instead of being in one location and having to do /bk to update the location?
|
Код:
new TimerGps[MAX_PLAYERS];
CMD:bk(playerid,params[])
{
new string[128], Float:X, Float:Y, Float:Z;
if(pInfo[playerid][Faction] == 1)
{
GetPlayerPos(playerid, X, Y, Z);
format(string, sizeof(string), "(Police Radio): %s is requesting backup at his position.", GetName(playerid));
PoliceBroadcast(COLOR_DARKBLUE,string,1);
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(pInfo[i][Faction] == 1)
{
SetPlayerCheckpoint(i, X, Y, Z, 3.0);
TimerGps[i]=SetTimerEx("playerpostion", 1000, 1,"dd",i,playerid);
BackupCP[playerid] = 1;
}
}
}
return 1;
}
forward playerpostion(i,playerid);
public playerpostion(i,playerid)
{
DisablePlayerCheckpoint(i);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerCheckpoint(i, x,y,z, 3.0);
}
CMD:dbk(playerid,params[])
{
DisablePlayerCheckpoint(playerid);
KillTimer(TimerGps[playerid]);
return 1;
}