PDA

View Full Version : [South Central] Need help, please


Pluzs
15/04/2016, 02:28 AM
Hi guys, I use South Central gamemode, but I have a problem with a cmds, only one and I can't resolve this..

The problem is the radio, when i define channel IG e.g: (/channel 3), the channel successfully change but when I type /r nothing happen in tchat..
Please I seriously need your help guys..

Script:
CMD:channel(playerid, params[])
{
new channel;

if (!Inventory_HasItem(playerid, "Radio Portable"))
return SendErrorMessage(playerid, "You must have a portable radio.");

if (sscanf(params, "d", channel))
{
SendSyntaxMessage(playerid, "/channel [radio channel] (0 to disable)");

if (PlayerData[playerid][pChannel] > 0)
SendClientMessageEx(playerid, COLOR_YELLOW, "[NOTE]:{FFFFFF} Your current radio channel is set to %d.", PlayerData[playerid][pChannel]);

return 1;
}
if (channel < 0 || channel > 999999)
return SendErrorMessage(playerid, "The channel can't be below 0 or above 999,999.");

PlayerData[playerid][pChannel] = channel;

if (channel == 0)
SendServerMessage(playerid, "You have disabled your portable radio.");

else SendServerMessage(playerid, "You have set your radio's channel to %d (\"/r [text]\" to chat).", channel);
return 1;
}

CMD:r(playerid, params[])
{
if (isnull(params))
return SendSyntaxMessage(playerid, "/r [Radio IC]");

if (!Inventory_HasItem(playerid, "Radio Portable"))
return SendErrorMessage(playerid, "You must have a portable radio.");

if (!PlayerData[playerid][pChannel])
return SendErrorMessage(playerid, "Your portable radio is disabled (/channel).");

static
string[128];
if(PlayerData[playerid][pChannel] == 911 && GetFactionType(playerid) != FACTION_POLICE) return SendErrorMessage(playerid, "This is police department's freqency only.");
if (strlen(params) > 64)
{
format(string, sizeof(string), "** [RADIO: %d] %s: %.64s",PlayerData[playerid][pChannel],ReturnName(playerid, 0), params);
SendRadioMessage(PlayerData[playerid][pChannel], COLOR_SERVER, string);
format(string, sizeof(string), "...%s **",params[64]);
SendRadioMessage(PlayerData[playerid][pChannel], COLOR_SERVER, string);
//SendNearbyMessage(playerid, 5.0, COLOR_SERVER, "** (Radio) %s: %.64s", ReturnName(playerid, 0), params);
//SendNearbyMessage(playerid, 5.0, COLOR_SERVER, "...%s **", params[64]);
}
else {
format(string, sizeof(string), "** [RADIO: %d] %s: %.64s",PlayerData[playerid][pChannel],ReturnName(playerid, 0), params);
SendRadioMessage(PlayerData[playerid][pChannel], COLOR_SERVER, string);
format(string, sizeof(string), "...%s **",params[64]);
SendRadioMessage(PlayerData[playerid][pChannel], COLOR_SERVER, string);
//SendNearbyMessage(playerid, 5.0, COLOR_SERVER, "** (Radio) %s: %.64s", ReturnName(playerid, 0), params);
}
return 1;
}

Pluzs
15/04/2016, 11:37 AM
up guys

Pluzs
15/04/2016, 07:50 PM
up..

BloodyRP
15/04/2016, 07:52 PM
show SendRadioMessage( function

benjaminjones
16/04/2016, 12:15 AM
Try to replace your SendRadioMessage function with this one/original one:
stock SendRadioMessage(frequency, color, const str[], {Float,_}:...)
{
static
args,
start,
end,
string[144]
;
#emit LOAD.S.pri 8
#emit STOR.pri args

if (args > 12)
{
#emit ADDR.pri str
#emit STOR.pri start

for (end = start + (args - 12); end > start; end -= 4)
{
#emit LREF.pri end
#emit PUSH.pri
}
#emit PUSH.S str
#emit PUSH.C 144
#emit PUSH.C string
#emit PUSH.C args

#emit SYSREQ.C format
#emit LCTRL 5
#emit SCTRL 4

foreach (new i : Player) if (Inventory_HasItem(i, "Portable Radio") && PlayerData[i][pChannel] == frequency) {
SendClientMessage(i, color, string);
}
return 1;
}
foreach (new i : Player) if (Inventory_HasItem(i, "Portable Radio") && PlayerData[i][pChannel] == frequency) {
SendClientMessage(i, color, str);
}
return 1;
}