Raised This Month: $29 Target: $400

Weapon Restrictions

Post New Thread Reply   
Thread Tools Display Modes
SourceMod Developer
Join Date: Jan 2008
Location: Atlanta, GA
Plugin ID:
Plugin Version:
Plugin Category:
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
    Plugin Description:
    Reason for Unapproving:
    Multiple errors. Author himself stated that plugin is not compatible with SM 1.2 or later. Some crashes reported. Author inactive for nearly a year.
    Old 04-15-2008 , 10:09   Weapon Restrictions
    Reply With Quote #1

    This plugin was designed and tested for use on Counter-Strike: Source. It uses some of the SDK Calls that teame06 wrote for GunGame: Source, and would not have been possible without the help of teame06, BAILOPAN, pRed, Tsunami, and many others who idle #sourcemod.

    If you have any questions or find any issues, please let me know either here or in #sourcemod on irc.gamesurge.net.

    Instructions for installation:

    Download and unzip the attached file. The zip file has been designed to mimic the structure of a standard srcds installation, and all files are in their correct places.

    I've expanded this out to use a translations file, a gamedata file, and two config files, so make sure you check the file contents before just dropping it in, or you will have trouble.

    This requires the latest version of the 1.0.3 Sourcemod snapshot.

    sm_restrict <weapon|group> <amount|default=0> <all=default|ct|t>
    sm_unrestrict <weapon|group> <all=default|ct|t>
    sm_addgroup <"group name"> <"weapon_one weapon_two weapon_three">

    -If you want to setup "static" groups, you will need to add the command to either server.cfg or restrict_weapons.cfg in the above format.
    -Ex. sm_addgroup "pistols" "glock p228 deagle"

    Valid weapons are:
    "glock", "usp", "p228", "deagle",
    "elite", "fiveseven", "m3", "xm1014",
    "galil", "ak47", "scout", "sg552",
    "awp", "g3sg1", "famas", "m4a1",
    "aug", "sg550", "mac10", "tmp",
    "mp5navy", "ump45", "p90", "m249",
    "flashbang", "hegrenade", "smokegrenade", "c4"
    --Totally rewrote the array setup for the restrictions.
    --Allowed the weapon restrictions to differ by team.
    --Added knives, pistols, and single-weapon round commands.
    --Modified unrestrict to allow all unrestrictions.
    --Added in restrict_weapons.cfg for the cfg\sourcemod for weapon\cvar management.
    --Rewrote all of the checks to be more efficient and faster.
    --Fixed a small problem in the g_ShortWeaponNames[] array.
    --Fixed a small problem in the g_WeaponNames[] array.
    --Added an additional check into the Command_Restrict function to send a message to the client/console and to also add a log to the error log with what was wrong.
    --Rewrote plugin from scratch to greatly improve efficiency and speed.
    --Added a public tracking cvar.
    --Repaired all bugs with weapons not being properly restricted.
    --Removed teame06's hack system.
    --Added checks to grab on round start, weapon_pickup, and weapon_fire.
    --Weapons refund money only on weapon_fire and if they are carrying it when restricted.
    --Fixed the version number in the plugin.
    --Added a warmup system
    --Exported warmup configs out to addmons\sourcemod\configs
    --Exported restriction configs out to cfg\sourcemod
    --Added a warmup cvar (g_Cvar_Warmup) so the warmup system is trackable for external plugins
    --Added sm_dropc4 for use on de_* maps
    --Added DropC4 to the Server Commands menu
    --Added Restrict Weapons to the Server Commands menu
    --Added cvars to handle all global weaon configs
    --Added cvars to handle warmup system
    --Exported all cvars to a single cfg file located in cfg/sourcemod
    --Added functions to watch the cvars and make changes as necessary
    --Fixed a bug in the cVar / cfg system
    --Fixed the issue with the cVars not restricting weapons properly on initial load.
    --Added sm_unrestrict all option. (sm_restrict <all|weapon> <all|team>)
    --Corrected the missing bracket in the code.
    --Added the polish translations. Thanks Zuko!
    --Added in additional cVars for weapon management.
    --Corrected the typo in the warmup cvar that had you set it to 2 to disable it. Should have been 0. Warmup disables without any issue.
    --Fixed the issue with weapons not restricting from the cfg file correctly.
    --Corrected issues with it not granting a valid weapon when one was restricted. (If you restrict them all, yes, they will walk around without a weapon.)
    --Corrected the bug in the warmup system.
    --Added a define in the code to remove the menu system from the compiled file. #define STOCK_MENUS 1, set to 0 to remove all menu functionality.
    --Added in checking for 'shorthand bind commands'.
    --Fixed a bug in the he/smoke/flashbang restrictions.
    --Fixed issues with restrictions not working correctly.
    --Corrected a bug where warmup wouldn't disable on first run of the plugin.
    --Fixed issues with it not removing restricted weapons from the world either on start or on drop.
    --Fixed issues with restrictions set in the cfg not parsing over map changes. (Thanks to Derek for pointing this out.)
    --Cleaned up the ConVar code a bit to make restrict.sp more organized.
    --Added group restrictions for weapons
    --Added sm_addgroup command
    --Added sm_grouplist command
    --Corrected a bug where it was stripping guns from teams who were not being restricted.
    --Cleaned up the weapon swap code to be faster and more efficient.
    --Cleaned up the core code to be more readable and organized
    --Corrected the bug in the warmup system where it wasn't stripping the starting weapons.
    --Rewrote the group restrict system to set the entire groups limit to a
    number. Ie. Group: "Test" contains "m4a1 ak47 p90" and is restricted to
    1. Only one m4a1, ak47, or p90 may be used. Any attempt to buy or
    pickup another weapon in that group will result in failure.
    --Corrected a bug in the weapon group buy code.
    --Changed the warmup config file format. Please replace or update yours correctly.
    --Changed the translation file format. Please replace yours with the one included.
    --Fixed a typo in the translation file format.
    Version 3.1 will include the following:
    --sm_knife and sm_pistols
    --team based restrictions in menu

    As always, when uploading this plugin, please -restart- your counter-strike server so that all old bad cvar values are nixed.

    Please let me know if you experience any issues.

    Attached Files
    File Type: zip restrict.zip (49.1 KB, 13238 views)
    Please don't PM me for support of my plugins. If you have a question, reply in the appropriate thread.

    Weapon Restrictions w/ Warmup
    High Ping Kicker - Lite Edition
    AFK Manager

    Last edited by Liam; 12-11-2008 at 19:08.
    Liam is offline
    Veteran Member
    Join Date: Oct 2005
    Location: Netherlands
    Old 04-15-2008 , 10:35   Re: Weapon Restrictions
    Reply With Quote #2

    This works like a charm, very good work finally a simple decent weapon restrictions plugin!
    tcviper is offline
    Send a message via MSN to tcviper
    SourceMod Developer
    Join Date: Jan 2008
    Location: Atlanta, GA
    Old 04-15-2008 , 11:15   Re: Weapon Restrictions
    Reply With Quote #3

    Updated to setup directory structure to match Sourcemod's. Also fixed an exploit that sfPlayer caught.

    Liam is offline
    Senior Member
    Join Date: May 2004
    Old 04-15-2008 , 11:52   Re: Weapon Restrictions
    Reply With Quote #4

    Great, thanks for your work! Two questions: is it possible to query the present restrictions? Are the restrictions saved, or do I need to exec the sm_restrict lines via a config file?
    [Arnold] is offline
    SourceMod Developer
    Join Date: Jan 2008
    Location: Atlanta, GA
    Old 04-15-2008 , 12:02   Re: Weapon Restrictions
    Reply With Quote #5

    Weapon restrictions are cleared at the end of each map. So if you want a weapon restricted every map you'll need it in server.cfg for now.

    sm_restrict awp
    sm_restrict awp 2
    sm_restrict awp 2 <team>

    One of my 'todos' is to add in a weapons.cfg file that will execute each map change, and that will be added in sometime in the near future.

    Now, insofar as current restrictions. No, there isn't any way to do that. I will make a note though and implement that at the same time I do the weapons.cfg.
    Liam is offline
    Senior Member
    Join Date: May 2004
    Old 04-15-2008 , 12:12   Re: Weapon Restrictions
    Reply With Quote #6

    Great! One last question: is there a way to lift all restrictions at a time or is sm_unrestrict limited to a specific weapon? If not, something like sm_unrestrict_all would come in handy.
    [Arnold] is offline
    SourceMod Developer
    Join Date: Jan 2008
    Location: Atlanta, GA
    Old 04-15-2008 , 12:32   Re: Weapon Restrictions
    Reply With Quote #7

    I'll add it to my todo list.

    Alternately, just change the map.
    Liam is offline
    Junior Member
    Join Date: Mar 2007
    Old 04-15-2008 , 12:53   Re: Weapon Restrictions
    Reply With Quote #8

    Is there anyway to allow the admins to use the restricted weapons?
    Snapcase452 is offline
    SourceMod Developer
    Join Date: Jan 2008
    Location: Atlanta, GA
    Old 04-15-2008 , 13:06   Re: Weapon Restrictions
    Reply With Quote #9

    Restricted is restricted. Its easily added in though.
    Liam is offline
    Senior Member
    Join Date: May 2004
    Old 04-15-2008 , 15:05   Re: Weapon Restrictions
    Reply With Quote #10

    I get lots of these error messages from the plugin:

    L 04/15/2008 - 21:03:12: [SM] Native "SDKCall" reported: Entity 98 is not valid or is freed
    L 04/15/2008 - 21:03:12: [SM] Debug mode is not enabled for "restrict.smx"
    L 04/15/2008 - 21:03:12: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 2 on
    [Arnold] is offline

    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 23:26.

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