[HELP] Police Radio - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Police Radio (
/showthread.php?tid=79089)
[HELP] Police Radio -
FreddeN - 25.05.2009
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...
Re: [HELP] Police Radio -
FreddeN - 25.05.2009
No one got any idea?
Re: [HELP] Police Radio -
Klutty - 25.05.2009
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
Re: [HELP] Police Radio -
JoeDaDude - 25.05.2009
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
Re: [HELP] Police Radio -
Hot - 25.05.2009
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!");
}