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.
Usage:
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">
sm_grouplist
sm_dropc4
Notes:
-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:
Code:
"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"
Changelog:
Code:
1.0
--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.
2.0
--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.
2.1
--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
2.2
--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
2.2
--Fixed a bug in the cVar / cfg system
2.3
--Fixed the issue with the cVars not restricting weapons properly on initial load.
--Added sm_unrestrict all option. (sm_restrict <all|weapon> <all|team>)
2.4
--Corrected the missing bracket in the code.
--Added the polish translations. Thanks Zuko!
2.5
--Added in additional cVars for weapon management.
2.6
--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.
2.7
--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'.
2.8
--Fixed a bug in the he/smoke/flashbang restrictions.
2.9
--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.
2.9b
--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.
3.0
--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
3.0.1
--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.
3.0.2
--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.
TODO:
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.
Enjoy!