31.10.2016, 11:13
(
Последний раз редактировалось AndySedeyn; 31.10.2016 в 14:27.
)
Is it possible to include the default CMD flag in every single command?
|
public OnGameModeInit()
{
for(new i = GetTotalCommandCount(); i >=0; i--)
{
new flags = GetCommandFlags(i);
if(flags & ACMD1) AdminLevel[i] = 1;
else if(flags & ACMD2) AdminLevel[i] = 2;
else if(flags & ACMD3) AdminLevel[i] = 3;
else if(flags & ACMD4) AdminLevel[i] = 4;
else if(flags & ACMD5) AdminLevel[i] = 5;
}
}
11111111111111111111111111111111
for(new i = (GetTotalCommandCount() - 1); i >= 0; i--)
CMD:report[help](cmdid, playerid, params[]) return SendClientMessage(playerid, -1, "Reports the player to an administrator."); CMD:report(cmdid, playerid, params[]) {...} CMD:pm[help](cmdid, playerid, params[]) return SendClientMessage(playerid, -1, "Sends a private message to the given player."); CMD:pm(cmdid, playerid, params[]) {...} CMD:help[help](cmdid, playerid, params[]) return SendClientMessage(playerid, -1, "Access server help topics."); CMD:help(cmdid, playerid, params[]) { new success; ExecuteCommand(params, "help", playerid, success, ""); switch(success) { case INVALID_COMMAND_ID: return SendClientMessage(playerid, RED, "The specified command does not exist."); case cellmin: return SendClientMessage(playerid, RED, "The specified command does not have a help description."); case 0: return SendClientMessage(playerid, RED, "Oops! Failed to fetch the description of the given command."); //case 1: handled by the command which was executed, i.e: a description message was sent to the player } return CMD_SUCCESS; }
That was planned to be done many days ago but haven't found a solution yet. Use CMD_SUCCESS for now.
Need to rework the defines to allow return 1 so it will take time. Once the include is updated, you can use Search & Replace dialog to replace all CMD_SUCCESS with return 1. |
enum flags (*=2) { ADMIN_COMMAND_FLAG = 1, TEST1, TEST2 }
v0.3 beta 14th November
Changes:
Код:
enum flags (*=2) { ADMIN_COMMAND_FLAG = 1, TEST1, TEST2 } *The tag for command flags could be changed in future (before going out of beta) *Open for suggestions |
return cmd_kiss(cid_kiss, playerid, "");
With zcmd, I used to return whole cmds with "return cmd_kiss(playerid, "");". If I try to do "return cmd_kiss(cmdid, playerid, "");" it give me error (error 017: undefined symbol "cmdid"). What should I do? I must use this function: GetCommandID?
|
static cmdid = -2; if(cmdid == -2) cmdid = GetCommandID("urcmd"); cmd_urcmd(cmdid, playerid, params);
cmd_urcmd(1231231, playerid, params)
You should change the prefix and macro names, makes it impossible to test in one go
Do it like in ycmd, only add a compatibility macro while using your own namespace |
"cid_*" is a new thing, cmdid was a parameter long before it was added.
|
Couldn't know that since I just found this topic, so time to remove it?
"Long before it was added", topic created on 23.10.2016 :/ |