SA-MP Forums Archive
zcmd + sscanf unknown command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: zcmd + sscanf unknown command (/showthread.php?tid=581509)



zcmd + sscanf unknown command - Amads - 13.07.2015

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);
        }
    }
}



Re: zcmd + sscanf unknown command - Hessu - 13.07.2015

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;
}



Re: zcmd + sscanf unknown command - Amads - 13.07.2015

Still 'Unknown command'


Re: zcmd + sscanf unknown command - gurmani11 - 13.07.2015

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);
        }
    }
}



Re: zcmd + sscanf unknown command - Amads - 13.07.2015

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.


Re: zcmd + sscanf unknown command - gurmani11 - 13.07.2015

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


Re: zcmd + sscanf unknown command - Amads - 13.07.2015

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 !