SA-MP Forums Archive
Admins can disable/enable commands ingame. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Admins can disable/enable commands ingame. (/showthread.php?tid=576628)



Admins can disable/enable commands ingame. - KamalBakri - 05.06.2015

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.


Re: Admins can disable/enable commands ingame. - Threshold - 05.06.2015

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


Re: Admins can disable/enable commands ingame. - Nubik - 05.06.2015

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.");



Re: Admins can disable/enable commands ingame. - KamalBakri - 05.06.2015

Helped, thanks.

1st reply thanks

2nd one, dont mind bro.


Re: Admins can disable/enable commands ingame. - JaydenJason - 05.06.2015

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