SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 15/04/2016, 02:28 AM   #1
Pluzs
Little Clucker
 
Pluzs's Avatar
 
Join Date: Apr 2013
Posts: 3
Reputation: 0
Angry [South Central] Need help, please

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:
Code:
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 is offline   Reply With Quote
Old 15/04/2016, 11:37 AM   #2
Pluzs
Little Clucker
 
Pluzs's Avatar
 
Join Date: Apr 2013
Posts: 3
Reputation: 0
Default Re: [South Central] Need help, please

up guys
Pluzs is offline   Reply With Quote
Old 15/04/2016, 07:50 PM   #3
Pluzs
Little Clucker
 
Pluzs's Avatar
 
Join Date: Apr 2013
Posts: 3
Reputation: 0
Default Re: [South Central] Need help, please

up..
Pluzs is offline   Reply With Quote
Old 15/04/2016, 07:52 PM   #4
BloodyRP
Big Clucker
 
Join Date: May 2013
Location: Estonia
Posts: 78
Reputation: 11
Default Re: [South Central] Need help, please

show SendRadioMessage( function
BloodyRP is offline   Reply With Quote
Old 16/04/2016, 12:15 AM   #5
benjaminjones
Huge Clucker
 
Join Date: Sep 2012
Posts: 449
Reputation: 80
Default Re: [South Central] Need help, please

Try to replace your SendRadioMessage function with this one/original one:
pawn Code:
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;
}
benjaminjones is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[GameMode] South Central Roleplay 0.20 iConvict Gamemode Scripts 1016 14/08/2020 06:11 PM


All times are GMT. The time now is 11:06 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.