Disable / enable a command
#1

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
Reply
#2

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
Reply
#3

Thats for blocking all commands.
Reply
#4

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;
  }
}

Reply
#5

hey thanks for this, i will try it, also i want it where only admins of level 5 can use it
Reply
#6

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...
Reply
#7

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..
Reply
#8

thanks haha, im a bit "noob" to this so i will have to look at other code to make menus and stff lol
Reply
#9

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.
Reply
#10

haha i give up im getting errors all over
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)