08.04.2016, 16:59
Used on the /backup system
I debugged it with printf - ID is 0 (aka nobody)
PHP код:
CMD:bk(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
if(!IsALeo(playerid) && !IsMedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a government official.");
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /backup [LEO/MEDIC]");
if(!strcmp(params, "leo", true))
{
if(Backup[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "You have already requested for police backup.");
Backup[playerid] = 1;
foreach(new i : Player)
{
if(IsACop(i) || IsSASD(i) || IsFBI(i))
{
SetPlayerMarkerForPlayer(i, playerid, 0x0000FFFF);
format(string, sizeof(string), "[Central Dispatch]: %s %s is requesting immediate backup, his coordinates have been marked on your GPS.", RPFRN(playerid), RPN(playerid));
SendClientMessage(i, COLOR_RADIO, string);
printf("The number is %d.",i);
return 1;
}
}
}
if(!strcmp(params, "medic", true))
{
if(Backup[playerid] == 2) return SendClientMessage(playerid, COLOR_GREY, "You have already requested for medical assistance.");
Backup[playerid] = 2;
foreach(new i : Player)
{
if(IsMedic(i))
{
SetPlayerMarkerForPlayer(i, playerid, 0xFF3366FF);
format(string, sizeof(string), "[Central Dispatch]: %s %s is requesting medical assistance, his coordinates have been marked on your GPS.", RPFRN(playerid), RPN(playerid));
SendClientMessage(i, COLOR_RADIO, string);
printf("The number is %d.",i);
return 1;
}
}
}
return 1;
}