07.05.2010, 14:50
pawn Code:
if(strcmp(cmd, "/backup", true) == 0 || strcmp(cmd, "/bk", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
{
if(CopOnDuty[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not on duty");
return 1;
}
if (PlayerInfo[playerid][pRequestingBackup] != 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[Radio:] All units, %s is requesting immediate assistance, location marked on the map (red)", sendername);
PlayerInfo[playerid][pRequestingBackup] = 1;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pFaction] == 0 || PlayerInfo[i][pFaction] == 6)
{
SetPlayerMarkerForPlayer(i, playerid, 0xFF0000FF);
SendClientMessage(i, COLOR_LSPD, string);
}
}
}
SendClientMessage(playerid, COLOR_WHITE, "[Info:] Type /backupclear or /bkc to clear your backup request");
SetTimerEx("BackupClear", 180000, false, "ii", playerid, 1);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You already have an active backup request");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid faction");
}
}
return 1;
}