18.08.2017, 12:13
I'm having issues that whenever a command has been disabled it can not be enabled.
This is the code I'm using, most of it has been directly copied from the tutorial and modified so it works properly in the gamemode.
This is the code I'm using, most of it has been directly copied from the tutorial and modified so it works properly in the gamemode.
PHP код:
forward CommandDisabled(cmdid, playerid, params[]);
public CommandDisabled(cmdid, playerid, params[])
{
SendErrorMessage(playerid, -1, "The command has been disabled.");
return 1;
}
CMD<DISABLECMDS>:disablecmd(cmdid, playerid, params[])
{
if(!adminCheck(playerid, 5)) return 0;
switch(ReassignCommandFunction(GetCommandID(params), "CommandDisabled"))
{
case -1: return SendClientMessage(playerid, COLOR_RED, "The entered command does not exist.");
case 0: return SendClientMessage(playerid, COLOR_RED, "The entered command is already disabled.");
case 1: return SendClientMessage(playerid, COLOR_WHITE, "The entered command has been "COL_RED"disabled"COL_WHITE".");
}
return CMD_SUCCESS;
}
CMD<DISABLECMDS>:enablecmd(cmdid, playerid, params[])
{
if(!adminCheck(playerid, 5)) return 0;
new cmd_func[MAX_FUNC_NAME], cid = GetCommandID(params);
GetCommandFunctionName(cid, cmd_func);
switch(ReassignCommandFunction(cid, cmd_func))
{
case -1: return SendClientMessage(playerid, COLOR_RED, "The entered command does not exist.");
case 0: return SendClientMessage(playerid, COLOR_RED, "The entered command is already enabled.");
case 1: return SendClientMessage(playerid, COLOR_WHITE, "The entered command has been "COL_GREEN"enabled"COL_WHITE".");
}
return CMD_SUCCESS;
}