Custom radio message problem
#1

I have a police radio script on my Cops'N'Robbers server that works fine with /r [message].
But im trying to script a custom message script with /dr [message], but that isn't working, i would like it to show like: "Dispatch: (text)".
But the normal radio works like this: "(faction which is LSPD) (name): (text)".
And the dispatch message comes out like this: "Dispatch: (name)".

Basically, instead of showing the text, it shows the name of the player that uses it, which is me.
So how do i switch it to say the text i put in?

Код:
CMD:dr(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsAGov(playerid) && !IsAHp(playerid) && !IsAFBI(playerid) && !IsALSEMS(playerid) && !IsAHSF(playerid) && !IsASWAT(playerid) && !IsASATF(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD/Government/FBI/LSEMS/HSF Officer.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dr [text]");
	//if(AntiAdv(playerid, params)) return 1;
	if(PlayerInfo[playerid][pFacDiv]){format(string, sizeof(string), "** Dispatch: %s", NORPN(playerid), params);}
	else {format(string, sizeof(string), "** Dispatch: %s", NORPN(playerid), params);}
	SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
	if(IsACop(playerid)) Log("logs/SAPD.log", string);
	else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
	else if(IsAFBI(playerid)) Log ("logs/FBI.log", string);
	else if(IsALSEMS(playerid)) Log ("logs/LSEMS.log", string);
	else if(IsAHSF(playerid)) Log ("logs/HSF.log", string);
	else if(IsASWAT(playerid)) Log ("logs/SWAT.log", string);
	else if(IsASATF(playerid)) Log ("logs/SATF.log", string);
	return 1;
}
Reply
#2

Very hard to understand what are you saying but i think you want this

pawn Код:
CMD:dr(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAGov(playerid) && !IsAHp(playerid) && !IsAFBI(playerid) && !IsALSEMS(playerid) && !IsAHSF(playerid) && !IsASWAT(playerid) && !IsASATF(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD/Government/FBI/LSEMS/HSF Officer.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /dr [text]");
    //if(AntiAdv(playerid, params)) return 1;
    if(PlayerInfo[playerid][pFacDiv]){format(string, sizeof(string), "** Dispatch: %s", params);}
    else {format(string, sizeof(string), "** Dispatch: %s", params);}
    SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
    if(IsACop(playerid)) Log("logs/SAPD.log", string);
    else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
    else if(IsAFBI(playerid)) Log ("logs/FBI.log", string);
    else if(IsALSEMS(playerid)) Log ("logs/LSEMS.log", string);
    else if(IsAHSF(playerid)) Log ("logs/HSF.log", string);
    else if(IsASWAT(playerid)) Log ("logs/SWAT.log", string);
    else if(IsASATF(playerid)) Log ("logs/SATF.log", string);
    return 1;
}
Reply
#3

You're formatting player name and params, but only displaying player name in the message as you only use one string. So remove NORPN(playerid) from format if you want to only display the params.
Reply
#4

Oh yeah, i removed the other one for the faction name, i forgot about the NORPN(playerid).
Thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)