Admins can disable/enable commands ingame.
#1

Well, I want someone to script me a command in zcmd by which admin can disable any command ingame and when player types that command, it says this command is disabled by admins.

if (adlvl[playerid] < 5) return 0;

Command must be for level 5 admins only, as listed upside.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=568459
Reply
#3

Here's how you can enable/disable a command in-game by typing /disablecmd rename disablecmd to whatever you want

Код:
new DisableCMD[MAX_PLAYERS];

CMD:disablecmd(playerid, params[])
{
	if (adlvl[playerid] < 5) return 0;
	if(DisableCMD == 1)
	{
		DisableCMD = 0;
		SendClientMessage(playerid, -1, "Command has been enabled.");
	}
	else
	{
		DisableCMD = 1;
		SendClientMessage(playerid, -1, "Command has been disabled.");
	}
	return 1;
}
use this in a command you want to be disabled
Код:
if(DisableCMD == 1) return SendClientMessage(playerid, COLOR_RED, "this command is disabled by admins.");
This only works for a single command though, to disable more commands you can make a new variable and command
for example:
Код:
new DisableCMD2[MAX_PLAYERS];

CMD:disablecmd2(playerid, params[])
{
	if (adlvl[playerid] < 5) return 0;
	if(DisableCMD2 == 1)
	{
		DisableCMD2 = 0;
		SendClientMessage(playerid, -1, "Command 2 has been enabled.");
	}
	else
	{
		DisableCMD2 = 1;
		SendClientMessage(playerid, -1, "Command 2 has been disabled.");
	}
	return 1;
}

if(DisableCMD2 == 1) return SendClientMessage(playerid, COLOR_RED, "this command is disabled by admins.");
Reply
#4

Helped, thanks.

1st reply thanks

2nd one, dont mind bro.
Reply
#5

don't think the
Код:
new DisableCMD2[MAX_PLAYERS];
is needed ere
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)