Raised This Month: $25 Target: $400
 6% 

Command Restrictions


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Server Management       
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-14-2017 , 13:40   Command Restrictions
Reply With Quote #1



Command Restrictions


Description
  • With this plugin you can restrict the access to certain commands in different ways. For example, you can make a command avaiable only for a player with a specific name, IP, SteamID, for players in a given team, only for dead/alive players, etc.

Notes
  • It is highly recommended that the plugin is put first in plugins.ini so it can properly catch commands from other plugins before they manage to do it. Even though I made it so it registers the commands earlier, some plugins may do the same thing too.
  • Bear in mind that many of the client commands cannot be restricted with an AMXX plugin.
  • When configured incorrectly, the plugin will throw an error in logs/CommandRestrictions.log saying the exact problem and on which line in the .ini file it is.
  • If you want to use the plugin on a game different than Counter-Strike, comment the line #define USE_CSTRIKE in the code.


Adding restrictions
  • The restrictions need to be added in the file configs/CommandRestrictions.ini.
  • The first thing you need to do is write the command name in square brackets. You can add multiple commands on the same line separated by commas. The same restrictions will apply to all of them.
  • On the next lines you can add the restrictions - one per line, following the syntax: <status> <type> "[value]" "[message]".
  • The third argument (value) doesn't need to be added when "type" is set to "all".
  • The fourth argument (message) is optional.
  • Here's a list of all possible arguments according to their type:
    • status - sets whether the restriction will allow or block the command usage
      • allow - allow usage
      • block - blocks usage
    • type - sets who the restriction is meant for
      • all - for all players
      • name - for a player with a given name
      • ip - for a player with a given IP address
      • steam - for a player with a given SteamID
      • flags - for players with (a) certain flag(s)
      • team - for players in a given team (ct, t, spec, unassigned)
      • life - for dead or alive players (alive, dead)
    • value - this is where you enter the needed information according to "type"
      • Example: if "type" is "name", you need to write the name of the player (case insensitive)
      • Example: if "type" is "team", you need to type in the team name - the allowed values can be found in the description above (in the brackets) - ct, t, spec, unassigned - have in mind that terrorist, spectator and other names are valid too, as long the first letter remains unchanged.
    • message - here you can set the message that will be sent to the player when the command is executed
      • If not set or is blank, the default message will be sent.
      • $cmd$ will be replaced with the command itself.
      • If set to #none, no message will be shown.

Restriction examples
  • Example #1 - blocks the "amx_slap" command for all players
    • [amx_slap]
    • block all
  • Example #2 - blocks the "/kick" chat command for all players except for those who have the flag "c"
    • [say /kick]
      block all
      allow flag "c"
  • Example #3 - blocks the "amx_quit" command for all dead players + spectators
    • [amx_quit]
    • block life "dead"
    • block team "spectators"
  • Example #4 - allows the "amx_boss" command only for a player with the given SteamID
    • [amx_boss]
    • block all
    • allow steam "STEAM_0:0:123456789"
  • Example #5 - disables the radio commands and sending a custom message when someone tries to use them
    • [radio1, radio2, radio3]
    • block all "" "The command &x04$cmd$ &x01is currently &x07disabled&x01."

Additional information and download link



__________________

Last edited by OciXCrom; 07-17-2018 at 09:04.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-14-2017 , 21:48   Re: Command Restrictions
Reply With Quote #2

Nice plugin.
__________________
Problem with ZP?
ZP Helper!
zmd94 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 12-15-2017 , 03:15   Re: Command Restrictions
Reply With Quote #3

Wonderful, nice efforts..
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
D3XT3R
AlliedModders Donor
Join Date: Nov 2016
Location: Lithuania, Bomb A (Kauna
Old 12-15-2017 , 08:46   Re: Command Restrictions
Reply With Quote #4

Good job =)
__________________
D3XT3R is offline
Send a message via Skype™ to D3XT3R
shady101
Member
Join Date: Nov 2014
Location: USA
Old 12-17-2017 , 22:06   Re: Command Restrictions
Reply With Quote #5

thank you for making this plugin the features seem great.
shady101 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-08-2018 , 15:02   Re: Command Restrictions
Reply With Quote #6


  • Added the ability to add multiple commands at once, which will use the same restrictions that are set below them.
  • Added the ability to change the message that is sent to the players when they try to use a blocked command, as well as the ability to completely disable it.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Natsheh
Veteran Member
Join Date: Sep 2012
Location: Muslim and proud!
Old 02-15-2018 , 14:20   Re: Command Restrictions
Reply With Quote #7

Here's AMX SUPPORT VERSION 1.8.2
Attached Files
File Type: sma Get Plugin or Get Source (crx_command_restrictions.sma - 380 views - 11.4 KB)
__________________
@Jailbreak MOD [Alot of features + API] 100% done !
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-15-2018 , 15:32   Re: Command Restrictions
Reply With Quote #8

Oh, damn. I totally forgot to check if the plugin will work on 1.8.2. I'll edit it tomorrow, the ArrayClone part can be skipped.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-16-2018 , 14:52   Re: Command Restrictions
Reply With Quote #9


  • Added AMXX 1.8.2 support.
  • Removed unnecessary code.

It's funny how I retained the plugin's functionallity by only removing 4 lines of code, avoiding usage of ArrayClone.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:48.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode