SA-MP Forums Archive
ZCMD Problem - 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 Problem (/showthread.php?tid=419212)



ZCMD Problem - Nathan_Taylor - 27.02.2013

So, I have this code written in my gamemode
Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
	 CMD:am(playerid, params[]
	{
		if(IsPlayerAdmin(playerid)){
		    new string[128];
		    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /am [message]");
		    format(string, sizeof(string), "%s", params);
		    SendClientMessageToAll(COLOR_LIGHTBLUE, string);
		    return 1;
			} else {
			    SendClientMessage(COLOR_LIGHTBLUE, "You don't have access to this command.");
			}
	}

	return 1;
}
When I compile, I get the following error
Код:
F:\SAMP\gamemodes\naterp.pwn(220) : error 017: undefined symbol "am"
F:\SAMP\gamemodes\naterp.pwn(221) : warning 217: loose indentation
F:\SAMP\gamemodes\naterp.pwn(224) : error 017: undefined symbol "params"
F:\SAMP\gamemodes\naterp.pwn(224) : error 029: invalid expression, assumed zero
F:\SAMP\gamemodes\naterp.pwn(224) : error 017: undefined symbol "params"
F:\SAMP\gamemodes\naterp.pwn(224) : fatal error 107: too many error messages on one line
What am I doing wrong?


Re: ZCMD Problem - 2KY - 27.02.2013

ZCMD commands do not go inside of a callback.

pawn Код:
CMD:am( playerid, params[] )
{
    if( IsPlayerAdmin ( playerid ) )
    {
        if( isnull ( params ) )
        {
            SendClientMessageToAll ( COLOR_LIGHTBLUE, params );
        }
        else return SendClientMessage ( playerid, -1, "USAGE: /am [ text ]" );
        // They typed /am with nothing after it.
    }
    else return false; // No permissions.
    return true;
}