DESCRIPTION:
This plugin allows you to set a maximum number of kills a player can get using a sniper rifle. Sniper rifles are grouped together as AWPs and AUTOs - you can set the Scout as a sniper rifle if you want as well.
When a player reaches their maximum sniper frags, they will be forced to drop their sniper rifle and equiped with the weapon you specify in the config file. You can set the replacement to "none" if you don't want to give them any weapon when they reach their sniper frag limit. Just be sure to use primary weapon_names
The restriction for the player will remain in effect until the map changes or they disconnect and reconnect to your server.
This plugin is also compatible with CS:S DM
Changes in 1.6.1 add ability to turn off advertisement of plugin to joining players, ability to advise players via hint chat regarding sniper kills left and pending removal of sniper rifle (if you use Drop On Round End CVar).
New in 1.6.3.2 is a cooldown period where you can optionally set a number of rounds a player must wait before being allowed to use sniper weapons again after they've been restricted. No longer need the sound.txt, instead set the sound file you want to use with the new CVar (sm_SniperRestrict_sound which is defaulted to buttons/weapon_cant_buy.wav).
In-Game Commands:
sm_snipers (!snipers or /snipers if using default triggers)
- Will display the current status of the player's sniper kills
CVars
"sm_SniperRestrict_cooldown" = "0" min. 0.000000 max. 25.000000
- Number of rounds that must pass before a player is allowed to use snipers again after being restricted. Use 0 to not use this feature.
"sm_SniperRestrict_sound" = "buttons/weapon_cant_buy.wav"
- Path and file name of sound file to use for restriction sound relative to sound folder.
"sm_SniperRestrict_snipers" = "weapon_awp weapon_g3sg1 weapon_sg550"
- List of weapons to consider sniper rifles, seperate weapon names with a space
"sm_SniperRestrict_advise" = "1" min. 0.000000 max. 1.000000
- Advise to players how many remaining sniper kills they have used?
"sm_SniperRestrict_advertise" = "1" min. 0.000000 max. 1.000000
- Advertise this plugin to joining players?
"sm_SniperRestrict_droproundend" = "0" min. 0.000000 max. 1.000000
- Drop the sniper weapon for the player who reached their limit at the rounds end?
"sm_SniperRestrict_notifyplayers" = "0" min. 0.000000 max. 1.000000
- Notify all players when another player reaches their sniper kill limit?
"sm_SniperRestrict_useupdater" = "0" min. 0.000000 max. 1.000000
- Utilize 'Updater' plugin to auto-update Sniper Restrict when updates are published?
1=yes, 0=no
"sm_SniperRestrict_maintainrestrictions" = "0" min. 0.000000 max. 1.000000
- (0,1) Maintain restrictions until map changes? If set to no (0) then players can just reconnect to be able to purchase snipers again.
"sm_SniperRestrict_restrictforbots" = "1" min. 0.000000 max. 1.000000
- (0,1) Restrict applies to bots as well as hunans?
"sm_SniperRestrict_destroyweapon" = "0" min. 0.000000 max. 1.000000
- (0,1) Destroy the Sniper weapon the player is holding when they reach their MaxSniperKills?
"sm_SniperRestrict_adminnotify" = "1" min. 0.000000 max. 1.000000
- (0,1) Notify admins when a player reaches their sniper kill limit - default is yes (1)
"sm_SniperRestrict_adminnotifycooldown" = "1" min. 0.000000 max. 1.000000
- (0,1) Notify admins when a player finishes their cooldown after being restricted?
"sm_SniperRestrict_maxsniperkills" = "5" min. 0.000000 max. 100.000000
- (0 to disable, number) Sets the max number of kills allowed with Snipers, per map
"sm_SniperRestrict_sniperreplace" = "weapon_scout"
- (weapon_name, none) Weapon to equip player once they've reached their MaxSniperKills limit
REQUIREMENTS:
Sourcemod 1.4+
SMLib (if you want to recompile yourself)
Updater if you want to automatically receive updates to this plugin. BTW, leave the SMX in the root of PLUGINS folder until issue is resolved with Updater
SDKHooks
CREDITS:
dalto and RedSword for weapon drop stuff and gamedata file
Dr!fter and RedSword because I learned a lot looking at their plugins
berni for SMLib
GoD-Tony for Updater
I know there are probably more because I looked at a LOT of different code and started going crossed eyed
TO DO LIST:
DONE -
Clean up code - there is a lot of redundance in it right now, but the plugin works good - tested it on a production server
DONE -
Add code to check if they bought a restricted weapon and refund their money if they did (or block it entirely)
DONE -
Add translation file so it's not hard coded in english. Update - still need to get to this
Maybe add a higher number of allowed sniper kills for those with reserved status (configurable flag and number of sniper kills)
Known Bugs:
FIXED -
The sound doesn't download - I'll fix that this weekend - it works now, thanks to Dr!fters :)
You'll have to download the attached SniperRestrict.smx file because the web compiler won't compile the .sp file due to smlib and updater includes. Also, the zip files has the
needed gamedata file and sound file and translation file.
INSTALLATION:
- Put SniperRestrict.smx in your addons/sourcemod/plugins folder
- Put wpndrop-cstrike.games.txt in your addons/sourcemod/gamedata folder
- put sound.txt in your cstrike\addons\sourcemod\configs\restrict folder
- Put restrictedweapon.wav in your sound/admin-plugin/actions folder (don't forget to put it on your fast download folder if you have a FastDL server)
- When you start up the plugin it will create a config file in cstrike/cfg/sourcemod folder called
SniperRestrict.plugin.cfg - edit to your heart's content - just don't set ScoutIsSniper to 1 and set replacement weapon as the scout as well.
- If you change the sound file, make sure you put change the addons/sourcemod/configs/restrict/sound.txt file as well. Just take note that the sound file listed there is also with the
weapon_restrict plugin.
Also in attachments is the old version just for historical purposes... Updated to include old files for 1.0 and 1.2c
CHANGE LOG
Version 1.0
- Initial release
Version 1.1
- Fixed when player purchased restricted weapon. It now refunds them the money
- Fixed the sound file not being downloaded by clients
Version 1.2c
- Cleaned up the code quite a bit - now it's not so cluttered
Version 1.3
- Added a setting and config entry to destroy the weapon when MaxSniperKills is reached. This was done by request (Iggy). When upgrading to this, you should let the plugin create a new config file.
Version 1.5.5
I've skipped a few version just because I haven't been releasing some of the changes I've been making. I wanted to make sure they were all done before I released a new version.
- Updated method of dropping weapons to use CS_DropWeapon (hence the requirement for Sourcemod 1.4). This hopefully fixes the weapon drop issues for
CSSDM
- Started using the CS_OnBuyCommand to handle the weapon purchasing for restricted weapons
- Changed from hooking item_pickup to using SDKHook_WeaponCanUse (SDKHooks is now required)
- Removed CVar DestroyPickedUpWeapon since SDKHooks will not allow a player to pickup a restricted weapon
- Added functionality to maintain the sniper restriction for players for the entire map even if the player disconnects and reconnects. The new cvar is sm_SniperRestrict_MaintainRestrictions
- Added Updater capability (see requirements for that on that plugins thread)
** It's probably best to delete your config file and let the plugin create a new one since I added a new CVar and removed an unused one.
Version 1.5.6
Now works with CS:S DM
- Enhanced plugin to give replacement weapon on respawns if running CSS:DM and player tries to get restricted weapon
Version 1.5.7
- Fixed [SM] Native "CloseHandle" reported: Handle 0 is invalid (error 4)
Version 1.5.8
- Bug fixes,
translation file added, and immune player addition
* Fixed CheckTimer (now ClearTimer, thanks to Antithasys from
http://forums.alliedmods.net/showthread.php?t=167160
* Added CheckCommandAccess and assigned "doNot_Restrict_Snipers" or ADMFLAG_CUSTOM2 to allow players to not be affected by this plugin.
* Inclusion of colors.inc for colored chat with translation files
Version 1.6.1
- Fixed sm_sniperrestrict_version from displaying old information contained in config file
- Added CVar for Updater - defaulted to off
- Added CVar to make weapon drop at round end instead of immediately
- Added CVar to notify all players when another player reaches sniper kill limit.
- Added CVar for player notifications for remaining sniper kills
Version 1.6.2 to 1.6.3.2
+ Added CVar so you can define your own sniper weapons.
* Fixed sound to work with CSGO
* Cleaned up client timer codes - now using client serials
* Went to 4 digit version numbers
* Updated and added translation phrases.
- Removed need for sound.txt
Version 1.6.3.3
+ Added CVar to control admin notifications for when players finish their cooldown rounds after being restricted.
If you have 1.5.5 (or newer) and Updater, then the plugin already updated itself (or will soon).
As of 1.6.1, the CVar for updater is defaulted to off.
New CVars in 1.6.3.3, so either add them manually or backup the old config file (rename it to .old) and let the plugin create a new config file, then edit that one.