Radio system not working. - 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)
+--- Thread: Radio system not working. (
/showthread.php?tid=504235)
Radio system not working. -
rangerxxll - 02.04.2014
i'm creating a radio system and want client messages to to be sent to anyone in the channel that the playerid is sending the message through. My channels consist of 1-50 and the variables are "PlayerRadio" and "PlayerRadioChannel". Self explanatory. Radio detects if they have a radio and the channel is what frequency they are in. (From 1-50.)
How would I send a message to players ONLY in the frequency that the playerid is in?
pawn Код:
stock SendClientMessageToRadio(playerid, color, const message[])
{
foreach(Player, i)
{
if(PlayerRadioChannel[i] == PlayerRadioChannel[playerid])
{
SendClientMessage(i, color, message);
}
}
}
CMD:r(playerid, params[])
{
if(GameProgress == 0) return SCM(playerid, COLOR_GREY, "Error: A game isn't in progress.");
if(PlayerRadio[playerid] == 0) return SCM(playerid, COLOR_GREY, "Error: You don't have a radio.");
new text[128];
if(sscanf(params, "s", text)) return SCM(playerid,COLOR_WHITE, "USAGE: /r(radio) [text]");
format(text,sizeof(text), "[Radio] %s: %s", GetName(playerid), text);
foreach(Player, i)
{
SendClientMessageToRadio(i, COLOR_GREEN, text);
}
return 1;
}
Re: Radio system not working. -
Aerotactics - 02.04.2014
EDITED:
pawn Код:
stock SendClientMessageToRadio(playerid, color, const message[])
{
foreach(Player, i)
{
if(PlayerRadioChannel[playerid] == PlayerRadioChannel[i])
{
SendClientMessage(i, color, message);
}
}
}
CMD:r(playerid, params[])
{
if(GameProgress == 0) return SCM(playerid, COLOR_GREY, "Error: A game isn't in progress.");
if(PlayerRadio[playerid] == 0) return SCM(playerid, COLOR_GREY, "Error: You don't have a radio.");
new text[128];
if(sscanf(params, "s", text)) return SCM(playerid,COLOR_WHITE, "USAGE: /r(adio) [text]");
format(text,sizeof(text), "[Radio] <Channel: %i> %s: %s", PlayerRadioChannel[playerid], GetName(playerid), text);
SendClientMessageToRadio(playerid, COLOR_GREEN, text);
return 1;
}
Re: Radio system not working. -
rangerxxll - 02.04.2014
Still doesn't show to players ONLY in the playerid's channel. It shows to everyone.
EDIT:A Fixed, thanks bud.