CMD || Problems... /r
#1

Radio chat... It doesnt display a thing...

Код:
CMD:r(playerid, params[])
{
	new string[128], text[100];
	if(PlayerInfo[playerid][pFaction] != 1 && PlayerInfo[playerid][pFaction] != 3 && PlayerInfo[playerid][pFaction] != 2)
	{
	    SendClientMessage(playerid, COLOR_GREY, "You are not in a faction with a radio.");
	    return 1;
	}
 	if(sscanf(params, "s[100]", text))
    {
        SendClientMessage(playerid, -1, "USAGE: /r(adio) [text]");
        return 1;
    }
	if(PlayerInfo[playerid][pFaction] == 1)
	{
	    if(PlayerInfo[playerid][pFacDiv] > 0)
		{
		format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
		}
			else
		{
		format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
	    }
	}
	if(PlayerInfo[playerid][pFaction] == 2)
	{
	    if(PlayerInfo[playerid][pFacDiv] > 0)
		{
		format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
		}
			else
		{
		format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
	    }
	}
	if(PlayerInfo[playerid][pFaction] == 3)
	{
	    if(PlayerInfo[playerid][pFacDiv] > 0)
		{
		format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
		}
			else
		{
		format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
  		SendClientMessageToLSPD(RADIO, string);
	    Log("/logs/radio.txt", string);
	    }
	}
	return 1;
}
Reply
#2

Try this


PHP код:
CMD:r(playeridparams[])
{
    new 
string[128], text[100];
    if(
PlayerInfo[playerid][pFaction] != && PlayerInfo[playerid][pFaction] != && PlayerInfo[playerid][pFaction] != 2)
    if(
sscanf(params"s[128]"text)) SendClientMessage(playeridCOLOR_GREY"USAGE: /r(adio) [text]");
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"You are not in a faction with a radio.");
        return 
1;
    }
    if(
PlayerInfo[playerid][pFaction] == 1)
    {
        if(
PlayerInfo[playerid][pFacDiv] > 0)
        {
        
format(stringsizeof(string), "* %s %s (%s): %s"GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
            else
        {
        
format(stringsizeof(string), "* %s %s: %s"GetRankName(playerid), GetName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
    }
    if(
PlayerInfo[playerid][pFaction] == 2)
    {
        if(
PlayerInfo[playerid][pFacDiv] > 0)
        {
        
format(stringsizeof(string), "* %s %s (%s): %s"GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
            else
        {
        
format(stringsizeof(string), "* %s %s: %s"GetRankName(playerid), GetName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
    }
    if(
PlayerInfo[playerid][pFaction] == 3)
    {
        if(
PlayerInfo[playerid][pFacDiv] > 0)
        {
        
format(stringsizeof(string), "* %s %s (%s): %s"GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
            else
        {
        
format(stringsizeof(string), "* %s %s: %s"GetRankName(playerid), GetName(playerid), text);
          
SendClientMessageToLSPD(RADIOstring);
        
Log("/logs/radio.txt"string);
        }
    }
    return 
1;

Reply
#3

pawn Код:
CMD:r(playerid, params[])
{
    new
        text[100]
    ;
    if(sscanf(params, "s[100]", text))
        return SendClientMessage(playerid, -1, "USAGE: /r(adio) [text]");

    switch(PlayerInfo[playerid][pFaction])
    {
        case 1:
        {
            new string[145];
            if(PlayerInfo[playerid][pFacDiv] > 0)
                format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
            else
                format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
            SendClientMessageToLSPD(RADIO, string);
            Log("/logs/radio.txt", string);
        }
        case 2:
        {
            new string[145];
            if(PlayerInfo[playerid][pFacDiv] > 0)
                format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
            else
                format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
            SendClientMessageToLSPD(RADIO, string);
            Log("/logs/radio.txt", string);
        }
        case 3:
        {
            new string[145];
            if(PlayerInfo[playerid][pFacDiv] > 0)
                format(string, sizeof(string), "* %s %s (%s): %s", GetRankName(playerid), GetName(playerid), GetDivisionName(playerid), text);
            else
                format(string, sizeof(string), "* %s %s: %s", GetRankName(playerid), GetName(playerid), text);
            SendClientMessageToLSPD(RADIO, string);
            Log("/logs/radio.txt", string);
        }
        default: SendClientMessage(playerid, COLOR_GREY, "You are not in a faction with a radio.");
    }
    return 1;
}
I noticed that you are using the same code for each faction... every time you are using 'SendClientMessageToLSPD". Are you sure you're not just using the wrong functions?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)