View Single Post
Plugin Info:     Modification:          Category:         
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