[HELP] Police Radio
#1

I want a police radio to the police team.
I have puted every skin in teams from 1-9, cops are team 9.
The cmd should be /radio, and send a blue (0x0000BBAA) message to everyone that used police skin.

Thanks for helping, I realy need this one.

NOTE: I have readed through the forums, cant find any that works...
Reply
#2

No one got any idea?
Reply
#3

As a command,

pawn Код:
if(strcmp(cmdtext , "/radio", true) == 0)
    {
        if (gTeam[playerid] == TEAM_LSPD)
            {
                if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3))
                    {
            new string[128];
                        new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid,playername,sizeof(playername));
                        format(string,sizeof(string),"*Radio: %s:%s",playername,cmdtext[128]);
                        SendCopMessage(0x0000BBAA, string);
                    }

                    else return SendClientMessage(playerid, 0xFFFF00AA, "Usage: /ra [message]");
                    }

                    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You are not a Police Officer");
                    }

As a function (insert anywhere):

pawn Код:
SendCopMessage(color, text[]) {
  for(new i = 0; i < MAX_PLAYERS; i ++) {
  if(IsPlayerConnected(i)) {
  if (gTeam[i] == TEAM_LSPD) {
      SendClientMessage(i, color, text);
      }
    }
  }
}
I'm not 100% sure this will work, but try
Reply
#4

i am also looking for this code for my roleplay as a faction chat, i can edit it :P
but how to mke it for 2/3 teams?

TEAM_FBI
TEAM_LSPD
TEAM_CIA

Ty,
Btw the code works
Reply
#5

Right code:

pawn Код:
if(strcmp(cmd, "/radio", true) == 0)
    {
        if(gTeam[playerid] == TEAM_LSPD || TEAM_FBI || TEAM_CIA)
            {
                if ((strlen(cmdtext) > 7)&&(strlen(cmdtext) <= 50))
                    {
                    new name[MAX_PLAYERS];
                    new message[128];
                    strmid(message,cmdtext,7,strlen(cmdtext));
                    GetPlayerName(playerid,name,sizeof(name));
                    format(string,sizeof(string),"-> Police Radio(%s): %s", name, message);
                    SendCopMessage(0xFFFF00AA, string);
                    return 1;
                    }

                    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You mean: /radio [Message]");
                    }

                    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You are not a Cop!");
                    }

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)