if(strcmp(cmd, "/takedrugs", true) == 0 || strcmp(cmd, "/td", true) == 0)
{
format(string, sizeof(string), "Command: %s: %s", sendername2, cmdtext);
SendCmdMessage(COLOR_YELLOW, string);
if (PlayerLoggedIn[playerid] != 1)
{
SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in");
return 1;
}
if(gTeam[playerid] != TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] != TEAM_ARMY && PlayerInfo[playerid][pRank] == 2)
{
SendClientMessage(playerid, COLOR_WHITE, "You are not in the cop team!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /takedrugs [playerid]");
return 1;
}
giveplayerid = strval(tmp);
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You are a law officer, you do not have any drugs.");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You are a COP you don't have drugs!"); return 1; }
if(giveplayerid != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "Command: %s: %s", sendername2, cmdtext);
SendCmdMessage(COLOR_YELLOW, string);
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
format(string, sizeof(string), "* You have taken away %s's Drugs.", giveplayer);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "* Officer %s has taken away your Drugs.", sendername);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
PlayerInfo[giveplayerid][pDrugs] = 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error: That player is not near you !");
return 1;
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "Error: That player is Offline !");
return 1;
}
}
I have created this command :
pawn Код:
|
public SendCmdMessage(color, string[])
{
new string2[256];
format(string2, sizeof(string2), "NOTICE @#pombear %s", string);
print(string2);
//ircSendRawData(EchoConnection, string2);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1 && Snoop[i] == 1)
{
SendClientMessage(i, color, string);
}
}
}