Raised This Month: $12 Target: $400
 3% 

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, during specific hours of the day 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.


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 and is ignored if <status> is set to "allow" or "pass".
  • Conditions are read from top to bottom, so the ones on top will get overwritten by the ones below them.
  • his means, for example, if you have a "block" condition in the first line and "allow" on the second - the "allow" condition will grant access to the command if it's true.
  • If you want to directly block or allow access to a command if the condition is met, use the "stop" and "pass" status types. This will ignore all following conditions.
  • 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 - allows access to the command based on the set criteria
      • block - blocks access to the command based on the set criteria
      • pass - allows access to the command based on the set criteria and ignores all other conditions if it's true
      • stop - blocksaccess to the command based on the set criteria and ignores all other conditions if it's true
    • type - sets who the restriction is meant for
      • all - targets all players (doesn't require the [value] argument)
      • name - targets players based on their name (case-insensitive)
      • ip - targets players based on their IP address
      • steam - targets players based on their SteamID
      • flags - targets players based on their admin flags (the player must have ALL of the specified flags)
      • anyflag - targets players based on their admin flags (the player needs to have AT LEAST ONE of the specified flags)
      • life - targets players based on whether they are dead or alive
      • team - targets players based on their team (only available in Counter-Strike)
      • rank - targets players based on their rank in CSStats (only available in Counter-Strike)
      • kills - targets players based on their number of kills in CSStats (only available in Counter-Strike)
      • deaths - targets players based on their number of deaths in CSStats (only available in Counter-Strike)
      • headshots - targets players based on their number of headshots in CSStats (only available in Counter-Strike)
      • score - targets players based on their score in the players list (TAB)
      • map - targets server maps (e.g. "de_dust2") or map types (e.g. "de_*") -- case-insensitive
      • time - targets specific hours of the day (e.g. "10:45 - 23:00")
      • level - targets players based on their current level (requires OciXCrom's Rank System)
      • xp - targets players based on their current amount of XP (requires OciXCrom's Rank System)
      • players - targets number of players currently in the server
    • 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 access to a command is blocked
      • 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."
  • Example #6 - allowing usage of "votemap" commands only during the night
    • [amx_votemap, amx_votemapmenu]
    • block all "" "You can vote for a map only during the night."
    • allow time "23:00 - 5:00"

Additional information and download link



__________________

Last edited by OciXCrom; 03-02-2021 at 08:36.
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.
zmd94 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 12-15-2017 , 03:15   Re: Command Restrictions
Reply With Quote #3

Wonderful, nice efforts..
__________________
@Jailbreak Main Mod v2.7.0 100%
@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
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 - 1093 views - 11.4 KB)
__________________
@Jailbreak Main Mod v2.7.0 100%
@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
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-18-2020 , 15:26   Re: Command Restrictions
Reply With Quote #10


  • Added an option to make commands available only during specific hours in the day, e.g. from 10:00 to 23:00.
__________________
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 19:14.


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