17.07.2018, 20:05
I've creating a cm command for cops! BUT idk why it's dose not shown the mesasge... can you help me? I mean If a player a cop or swat and sending a message to ALL TEAM POLICE they must read it and civilan's players must not read it.. I've do everything but its not work..
PHP код:
CMD:cm(playerid, params[])
{
if(!PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command.");
new message[100];
if(sscanf(params, "s[100]", message)) return SendClientMessage(playerid, RED, "[USAGE]: /CM [Message]");
if(strlen(message) < 1 || strlen(message) > 100) return SendClientMessage(playerid, RED, "{ff0000}Error: {FFFFFF}Your message can only contain 1-100 characters.");
{
if(!PoliceTeam(GetPlayerSkin(playerid)))
{
format(fstr, sizeof(fstr), "[COP RADIO]: OFFICER %s[%d]: %s.", GetName(playerid), playerid, message);
CopRadio(COLOR_DODGERBLUE, fstr);
}
if(!SWAT(GetPlayerSkin(playerid)))
{
format(fstr, sizeof(fstr), "[COP RADIO]: S.W.A.T %s[%d]: %s.", GetName(playerid), playerid, message);
CopRadio(COLOR_DODGERBLUE, fstr);
}
if(!Army(GetPlayerSkin(playerid)))
{
format(fstr, sizeof(fstr), "[COP RADIO]: A.R.M.Y %s[%d]: %s.", GetName(playerid), playerid, message);
CopRadio(COLOR_DODGERBLUE, fstr);
}
if(!FBII(GetPlayerSkin(playerid)))
{
format(fstr, sizeof(fstr), "[COP RADIO]: FBI %s[%d]: %s.", GetName(playerid), playerid, message);
CopRadio(COLOR_DODGERBLUE, fstr);
}
if(!CIA(GetPlayerSkin(playerid)))
{
format(fstr, sizeof(fstr), "[COP RADIO]: C.I.A %s[%d]: %s.", GetName(playerid), playerid, message);
CopRadio(COLOR_DODGERBLUE, fstr);
}
}
return 1;
}
PHP код:
stock CopRadio(color,const string[])
{
foreach(new i : Player)
{
if(GetPlayerState(i) != PLAYER_STATE_NONE)
{
if(!PoliceTeam(GetPlayerSkin(i)) && !SWAT(GetPlayerSkin(i)) && !Army(GetPlayerSkin(i)) && !FBII(GetPlayerSkin(i)) && !CIA(GetPlayerSkin(i)))
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}