CMD:backup(playerid, params[])
{
new string[128], Float:bkx, Float:bky, Float:bkz;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid)&& !IsMedic(playerid)&& !IsFireman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO.");
if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty.");
GetPlayerPos(playerid, bkx, bky, bkz);
format(string, sizeof(string), "[Central Dispatch]: %s is requesting backup,his coordinates have been marked on the GPS.", RPN(playerid));
SendCopMessage(COLOR_RADIO, string);
foreach(Player, i)
{
if(IsACop(i))
{
SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP);
}
}
return 1;
}
I'm trying to do backup command,
Now it's only for the police and I want make it for more few factions. Can someone help me and fix the code that I give? PHP код:
|
if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid)&& !IsMedic(playerid)&& !IsFireman(playerid))
foreach(Player, i)
{
SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP);
}
here, you check if they're a LEO.
pawn Код:
this means that for ppls who are not LEO's the code processing stops right here. so you don't have to check it again in your "foreach". just pawn Код:
![]() |
warning 209: function "cmd_backup" should return a value
error 010: invalid function or declaration
CMD:backup(playerid, params[])
{ new string[128], Float:bkx, Float:bky, Float:bkz; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid)&& !IsMedic(playerid)&& !IsFireman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO."); if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty."); GetPlayerPos(playerid, bkx, bky, bkz); format(string, sizeof(string), "[Central Dispatch]: %s is requesting backup,his coordinates have been marked on the GPS.", RPN(playerid)); SendCopMessage(COLOR_RADIO, string); foreach(Player, i) { if(IsACop(i)) { SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP); } return 1; } Try |
Код:
CMD:backup(playerid, params[]) { new string[128], Float:bkx, Float:bky, Float:bkz; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid)&& !IsMedic(playerid)&& !IsFireman(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not a LEO."); if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty."); GetPlayerPos(playerid, bkx, bky, bkz); format(string, sizeof(string), "[Central Dispatch]: %s is requesting backup,his coordinates have been marked on the GPS.", RPN(playerid)); SendCopMessage(COLOR_RADIO, string); foreach(Player, i) { if(IsACop(i)) { SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP); } } } return 1; } |
warning 209: function "cmd_backup" should return a value
error 010: invalid function or declaration
Код:
CMD:backup(playerid, params[]) { new string[128], Float:bkx, Float:bky, Float:bkz; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid) && !IsMedic(playerid) && !IsFireman(playerid)) if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty."); GetPlayerPos(playerid, bkx, bky, bkz); format(string, sizeof(string), "[Central Dispatch]: %s is requesting backup,his coordinates have been marked on the GPS.", RPN(playerid)); SendCopMessage(COLOR_RADIO, string); foreach(Player, i) { if(IsACop(i)) { SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP); } else { SendClientMessage(playerid, COLOR_GREY, "You are not a LEO."); } } return 1; } |
Код:
CMD:backup(playerid, params[]) { new string[128], Float:bkx, Float:bky, Float:bkz; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(!IsACop(playerid) && !IsFBI(playerid) && !IsNG(playerid) && !IsCTU(playerid) && !IsMedic(playerid) && !IsFireman(playerid)) if(!PlayerInfo[playerid][pFacDuty]) return SendClientMessage(playerid, COLOR_GREY, "You are not on duty."); GetPlayerPos(playerid, bkx, bky, bkz); format(string, sizeof(string), "[Central Dispatch]: %s is requesting backup,his coordinates have been marked on the GPS.", RPN(playerid)); SendCopMessage(COLOR_RADIO, string); foreach(Player, i) { if(!IsACop(i) && !IsFBI(i) && !IsNG(i) && !IsCTU(i) && !IsMedic(i) && !IsFireman(i)) { SetPlayerMarkerForPlayer(i, playerid, COLOR_BACKUP); } else { SendClientMessage(playerid, COLOR_GREY, "You are not a LEO."); } } return 1; } |