Help with using zcmd
#2

You can just delete OnPlayerCommandText from your script and add two new callbacks instead.

pawn Код:
/*
this callback is called when someone sends a command.
if you return 0 here, the command won't be performed.
*/

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(GetPlayerState(playerid) == PLAYER_STATE_WASTED) //if wasted, can't perform commands
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "Commands are temporary disabled.");
        return 0;
    }
    return 1;
}

/*
this callback gets called after command execution, here if you do
"return 0" the player will see standard "Unknown command" message.
*/

public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(success)
    {
        return 1;
    }
    return 0;
}

//your command is here
CMD:test(playerid, params[])
{
    #pragma unused params
    SendClientMessage(playerid, COLOR_RED, "This is a test cmd");
    return 1;
}
But note that you don't need to add those callbacks, if you don't use them.
Reply


Messages In This Thread
Help with using zcmd - by XoX - 15.01.2011, 10:38
Re: Help with using zcmd - by Stylock - 15.01.2011, 11:26
Re: Help with using zcmd - by XoX - 15.01.2011, 11:45

Forum Jump:


Users browsing this thread: 1 Guest(s)