Disable / enable a command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Disable / enable a command (
/showthread.php?tid=152827)
Disable / enable a command -
rellyboy105 - 05.06.2010
I want to make a menu with certain items that are only used by admins (tank, hunter, rocket launcher, minigun) . I want to beable to disable/enable this command when ever in game. I want this command to be able to be used by all players, but only if I enable it. Please if someone is nice to make me a filterscript for this
Re: Disable / enable a command -
[HiC]TheKiller - 06.06.2010
pawn Код:
new RestrictCMD;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/Blockcmd", true)
{
if(!IsPlayerAdmin(playerid)) return 0;
if(RestrictCMD == 0)
{
RestrictCMD = 1;
SendClientMessage(playerid, COLOR, "Restricted the command");
}
if(RestrictCMD == 1)
{
RestrictCMD = 0;
SendClientMessage(playerid, COLOR, "Un-restricted the command");
}
}
if(!strcmp(cmdtext, "/Randomcmd", true)
{
if(RestrictCMD == 1) return 0;
//Rest of command here
}
return 0;
}
Hope it helped
~[HiC]TheKiller
Re: Disable / enable a command -
Antonio [G-RP] - 06.06.2010
Thats for blocking all commands.
Re: Disable / enable a command -
[HiC]TheKiller - 06.06.2010
Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Thats for blocking all commands.
|
No it's not, it's for a single command. Blocking all commands would be like this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
return 0;
if(!strcmp(cmdtext, "/cmd1", true)
{
//.......
return 1;
}
if(!strcmp(cmdtext, "/cmd2", true)
{
//.......
return 1;
}
if(!strcmp(cmdtext, "/cmd3", true)
{
//.......
return 1;
}
}
Re: Disable / enable a command -
rellyboy105 - 06.06.2010
hey thanks for this, i will try it, also i want it where only admins of level 5 can use it
Re: Disable / enable a command -
Scenario - 06.06.2010
Quote:
Originally Posted by rellyboy105
hey thanks for this, i will try it, also i want it where only admins of level 5 can use it
|
Thats simple, where you see "IsPlayerAdmin", just add your level 5 admin variable...
Re: Disable / enable a command -
Antonio [G-RP] - 06.06.2010
Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Thats for blocking all commands.
|
No it's not, it's for a single command. Blocking all commands would be like this:
|
Wrong, because the command doesn't show WHICH command it is blocking..
Re: Disable / enable a command -
rellyboy105 - 06.06.2010
thanks haha, im a bit "noob" to this so i will have to look at other code to make menus and stff lol
Re: Disable / enable a command -
[HiC]TheKiller - 06.06.2010
Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Quote:
Originally Posted by [HiC
TheKiller ]
Quote:
Originally Posted by Antonio (eternalrp.webatu.com)
Thats for blocking all commands.
|
No it's not, it's for a single command. Blocking all commands would be like this:
|
Wrong, because the command doesn't show WHICH command it is blocking..
|
Dude, you are wrong. Wait for someone else to say what's right.
Re: Disable / enable a command -
rellyboy105 - 06.06.2010
haha i give up im getting errors all over