ZCMD Problem
#1

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?
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)