02.06.2016, 01:37
Great job! I hope that you will keep updating it - and it would be cool if someone posts a benchmark with ZCMD, YCMD and iZCMD and maybe other command processors.
@YourShadow Can you let us have some more features like:
- Not ignoring the return value, so we can hide commands - Disabling commands for certain players, which would return 0 for them |
public OnPlayerReceivedCommand(playerid, cmd[], params[], bool:exists)
{
if (playerid ...) // condition
{
SendClientMessage(playerid, 0xFFFFFFFF, "This command not available for you");
return 0; // will not call "cmd: ..."
}
return 1;
}
cmd:ban(playerid, params[])
{
if (pAdmin[playerid] == 0) // condition
{
SendClientMessage(playerid, 0xFFFFFFFF, "This command not available for you");
return; // exit from function
}
// code here
}
CMD:command(playerid, params[], cmd_id)
public OnPlayerReceivedCommand(playerid, cmd_id, params[], bool:exists) { switch(cmd_id) { // CODE GOES HERE } }
Maybe something like this
Code:
CMD:command(playerid, params[], cmd_id) Code:
public OnPlayerReceivedCommand(playerid, cmd_id, params[], bool:exists) { switch(cmd_id) { // CODE GOES HERE } } |
native SetPlayerCommandAllowed(playerid, cmdname[], bool:allow);
forward OnPlayerReceivedCommand(playerid, cmd[], params[], bool:exists, result, bool:allowed);
CMD:command(playerid, params[], cmd_id, class_is)
cmd_id:pm(CMD_PM);
cmd:pm(playerid, params[])
{
return 1;
}
alias:pm("sms");
public OnPlayerCommandReceived(playerid, cmdtext[]) // executed before cmd
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], cmdid, result) // executed after cmd
{
if (result == -1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command.");
return;
}
if (cmdid == CMD_PM)
{
//
}
// else if ...
}