zcmd + sscanf unknown command
#1

Hello!

I have no idea why, but when i use the command /r, (works fine btw) it spits out 'unknown command' message. /opis doesn't have this problem tho.

Here's the code:
Код:
CMD:opis(playerid, params[])
{
	    new string[128], opis[100];

	    if(sscanf(params, "s[100]", opis))
			return SendClientMessage(playerid, COLOR_GREY, "* Użyj: "C_WHITE"/opis [TEKST]");
	    if(Druzyna[playerid] != 1)
	        return SendClientMessage(playerid,COLOR_GREY,"* Nie jesteś człowiekiem!");

		format(string, sizeof(string), "* %s (%s)", opis, PlayerName(playerid));
		ProxDetector(25, playerid, string, COLOR_MORSKI);
	    return 1;
}

CMD:r(playerid, params[])
{
		new msg[120],string[128];
		
		if(sscanf(params,"s[120]", msg))
			return SendClientMessage(playerid, COLOR_GREY, "* Użyj: "C_WHITE"/r [TREŚĆ]");
		if(Druzyna[playerid] != 1)
			return SendClientMessage(playerid,COLOR_GREY,"* Nie jesteś człowiekiem!");

    	ApplyAnimation(playerid,"PED","phone_talk",4.1,0,0,0,0,0);
		format(string, sizeof(string), "%s", msg);
        SendRadioMessage(playerid, COLOR_GOLD, string);
        PlayerPlaySound(playerid, 2601, 0, 0, 0);
        return 1;
}
Код:
stock SendRadioMessage(fromid, colour, msg[])
{
    new pName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(fromid, pName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "[RADIO]"C_WHITE" %s: %s", pName, msg);

    printf("[RADIO] %s",string);

    for(new i; i < GetMaxPlayers(); i++)
    {
        if(Druzyna[i] == 1)
        {
            SendClientMessage(i, colour, string);
        }
    }
}
Reply
#2

Try no harm done

pawn Код:
CMD:r(playerid, params[])
{
       new msg[120],string[128];
       
    if(sscanf(params,"s[120]", msg))
        {
        SendClientMessage(playerid, COLOR_GREY, "* Użyj: "C_WHITE"/r [TREŚĆ]");
                return 1;
        }
    if(Druzyna[playerid] != 1)
        {
        SendClientMessage(playerid,COLOR_GREY,"* Nie jesteś człowiekiem!");
                return 1;
         }
        ApplyAnimation(playerid,"PED","phone_talk",4.1,0,0,0,0,0);
    format(string, sizeof(string), "%s", msg);
        SendRadioMessage(playerid, COLOR_GOLD, string);
        PlayerPlaySound(playerid, 2601, 0, 0, 0);
        return 1;
}
Reply
#3

Still 'Unknown command'
Reply
#4

pawn Код:
CMD:r(playerid, params[])
{
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "* Użyj: "C_WHITE"/r [TREŚĆ]");
    if(Druzyna[playerid] != 1)return SendClientMessage(playerid,COLOR_GREY,"* Nie jesteś człowiekiem!");
        ApplyAnimation(playerid,"PED","phone_talk",4.1,0,0,0,0,0);
        SendRadioMessage(playerid, COLOR_GOLD, params);
        PlayerPlaySound(playerid, 2601, 0, 0, 0);
        return 1;
}
stock SendRadioMessage(fromid, colour, params[])
{
    new pName[MAX_PLAYER_NAME], string[128];
    GetPlayerName(fromid, pName, MAX_PLAYER_NAME);
    format(string, sizeof(string), "[RADIO]"C_WHITE" %s: %s", pName, params);

    printf("[RADIO] %s",string);

    for(new i; i < GetMaxPlayers(); i++)
    {
        if(Druzyna[i] == 1)
        {
            SendClientMessage(i, colour, string);
        }
    }
}
Reply
#5

Aaaand 'Unknown command' :/

I figured out that when I remove 'SendRadioMessage(playerid, COLOR_GOLD, string);' line from cmd:r it doesn't show 'unknown command' message... so I guess there's something wrong with the stock.
Reply
#6

have you copied the whole command that i edited?
i think no
Reply
#7

I've just checked something. It works fine on my home server (Windows), and spits out 'unknown command' on a public server (which works on Linux). Well, this is interesting.
(YES, i've added 'plugins sscanf.so' to server.cfg)

// Nevermind, fixed it! Apparently there was a problem with GetMaxPlayers(); Thanks for help tho !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)