04.04.2014, 22:53
Title says it.
My checkpoint only updates for the person with ID 0.
The checkpoint shows for ID 1 - ID x but it doesn't update with the new location of the PD member.
It only updates for ID 0.
Command:
Timer:
Help is much appreciated.
My checkpoint only updates for the person with ID 0.
The checkpoint shows for ID 1 - ID x but it doesn't update with the new location of the PD member.
It only updates for ID 0.
Command:
pawn Код:
if(strcmp(cmdtext, "/bku", true) == 0)
{
if(IsACop(playerid))
{
new string[256];
if(backuprequester[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You've requested backup already! (/bkc to cancel)");
if(backuprequested == 1) return SendClientMessage(playerid, COLOR_GREY, "Someone else request backup already!");
SendClientMessage(playerid, COLOR_GREY, "Type in /bkc to cancel the backup");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
backuprequested = 1;
backuprequester[playerid] = 1;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
format(string, sizeof(string), "* Dispatch: %s[%d] is in need of backup! Location at (%s)",GetPlayerNameEx(playerid),playerid, location);
SendClientMessage(i, COLOR_LIGHTBLUE, string);
SetPlayerCheckpoint(i, x, y, z, 5);
backuptimer[i] = SetTimerEx("updatebackup", 1000, true, "i", playerid);
}
}
}
return 1;
}
}
if(strcmp(cmdtext, "/bkc", true) == 0)
{
if(IsACop(playerid))
{
new string[256];
if(backuprequester[playerid] == 0) return SendClientMessage(playerid, COLOR_GREY, "You've not requested any backup!");
backuprequested = 0;
backuprequester[playerid] = 0;
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
format(string, sizeof(string), "* Dispatch: %s[%d] has canceled his backup", GetPlayerNameEx(playerid),playerid);
SendClientMessage(i, COLOR_LIGHTBLUE, string);
KillTimer(backuptimer[i]);
DisablePlayerCheckpoint(i);
}
}
}
return 1;
}
}
pawn Код:
forward updatebackup(playerid);
public updatebackup(playerid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
for (new i = 0; i < MAX_PLAYERS; i++)
{
DisablePlayerCheckpoint(i);
SetPlayerCheckpoint(i, x, y, z, 5);
return 1;
}
return 1;
}

