[HELP] Help me with a simple Police Radio
#1

I have finaly succeded to place skins in teams, now I want a police radio for the police team.
I want the radio to work like /tpm but you type "/ra [text]".
And this msg is going to be sended just like tpm, in the police team.

Thanks for helping, and btw, the police team number is "6", if that can help...

Anyway thanks!
Reply
#2

Any ideas?
Reply
#3

pawn Код:
if(!strcmp("/ra", cmdtext, true))
{
    if(cmdtext[3] == 0) return SendClientMessage(playerid, COLOR_RED, "/ra [text]");
    new playername[26];
    GetPlayerName(playerid, playername, 26);
    format(string, sizeof(string), "COP: %s > %s", playername, cmdtext[3]);
    for(new i=0;i<MAX_PLAYERS;i++)
    { if(GetPlayerTeam(playerid) == 6) { SendClientMessage(i, COLOR_BLUE, string); } }
    return 1;
}
you could do something like this, but edit it to match your specs.
Reply
#4

Quote:
Originally Posted by Pandabeer1337
pawn Код:
if(!strcmp("/ra", cmdtext, true))
{
   if(cmdtext[3] == 0) return SendClientMessage(playerid, COLOR_RED, "/ra [text]");
   new playername[26];
   GetPlayerName(playerid, playername, 26);
   format(string, sizeof(string), "COP: %s > %s", playername, cmdtext[3]);
   for(new i=0;i<MAX_PLAYERS;i++)
   { if(GetPlayerTeam(playerid) == 6) { SendClientMessage(i, COLOR_BLUE, string); } }
   return 1;
}
you could do something like this, but edit it to match your specs.
Didn't work... hmm... do you know the /tpm script? Then I can just edit it...
Reply
#5

You probably use a different team setup to his. His code doesn't appear to be wrong...

And what the hell is /tpm? If it's from GF we'll scream.
Reply
#6

Quote:
Originally Posted by Weirdosport
You probably use a different team setup to his. His code doesn't appear to be wrong...

And what the hell is /tpm? If it's from GF we'll scream.
/tpm ? That is Team PM
It's already in the script when it's new like /pm, when you make teams, it wil appear automaticly.
Reply
#7

This is the radio I used for my Roleplay for cops...

pawn Код:
new RadioChat[128];
    if(text[0] == '!' && text[1] != 0)
    {
        if(gTeam[playerid] == 6)
        {
            for(new i = 0; i < MAX_PLAYERS; i++ )
            {
                format(RadioChat, sizeof(RadioChat), "(Cop Radio) %s: %s",PlayerNam(playerid),text[1]);
                if(gTeam[i] == 6)
                {
                    SendClientMessage(i, RADIO_COLOR, RadioChat);
                }
            }
        }
        return 0;
    }
So when a Cop types !Hello. It will come out as:
(Cop Radio) Name: Hello.
Reply
#8

what variable you use for your teams?
Reply
#9

Quote:
Originally Posted by Pandabeer1337
what variable you use for your teams?
I use this:

Код:
AddPlayerClassEx(6,280,-1606.3750,675.9275,-5.2422,358.2930,0,0,0,0,0,0); // Officer Skin 1
Then at skin selection (maybe not needed for you to help)?

Код:
		case 16:
		{
 			GameTextForPlayer(playerid,"Police Officers",3000,3);
	    {
	  		SetPlayerPos(playerid,-2261.1143,1012.0626,83.6106);
				SetPlayerCameraPos(playerid,-2261.1143,1016.7200,83.6334);
				SetPlayerCameraLookAt(playerid,-2261.1143,1012.0626,83.6106);
				SetPlayerFacingAngle(playerid,357.6576);
				SetPlayerColor(playerid,0x000080FF);
			}
Then I use this at OnPlayerSpawn:

Код:
SetPlayerTeam( playerid, 6 );
Reply
#10

should create a variable, gTeam[MAX_PLAYERS]; so itll store the team number so you can easely make commands for one special team.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)