DESCRIPTION:
This plugin is the result of a request by wazzgod - he had the idea of a plugin that would intercept player suicides and instead of instant death, have it be a delayed death (
http://forums.alliedmods.net/showthread.php?t=162870)
I know I get frustrated when I'm about to get a kill stat and they kill themselves, robbing me of a stat. Well, this plugin will delay that request, notify the player of the intercept via chat and center chat, and if they survive my attack somehow, they'll be slain anyways after X seconds (set in config file SuicideIntercept.plugin.cfg in cstrike/cfg/sourcemod).
This plugin will intercept player suicide attempts by capturing the following commands
* kill
* jointeam
* joinclass
* spectate
* explode
Plugin can be en/disabled via cvar sm_suicideintercept_enabled 1/0
Configurable number of delay seconds to carry out players requested suicide.
By default, ROOT admins are immune to the delays this plugin imposes. If you'd like to grant other admin flags immunity to this plugin, just add the following in the admin_overrides.cfg
"bypass_suicideintercept" "abo"
The above would allow those players with flags "a" "b"
AND "o" immunity from delays this plugin imposes.
REQUIREMENTS:
Plugin was compiled with SourceMod 1.4.0
1.3.8 and has includes of <sourcemod> and <sdktools> and <colors>
OPTIONAL:
Updater plugin if you want this plugin to stay updated with changes and bug fixes.
CREDITS:
wazzgod for idea (
REQ thread) - he posted one, but requested I post mine for approval (
here)
KyleS for the suggestions on cleaning up the code :)
INSTALLATION:
- Put the SMX in your cstrike/addons/sourcemod/plugins folder
- Put the SuicideIntercept.phrases.txt in your cstrike/addons/sourcemod/translations folder
- Either manually start the plugin, change the map, or restart your server
--------------------------
Thanks again to wazzgod for the idea!! I hope people find this plugin useful and fun.
BTW, the reason I included joinclass as a suicide command to intercept is because
Zombie:Reloaded uses it and this plugin "could" be used with that mod if you wanted to delay the suicide instead of outright blocking it (which is an option in ZR)
If you find a bug, post it here and I'll jump on it. If there are additional commands players can type to suicide, post it here and I'll add them.
CHANGE LOG
Version 1.0
- Initial public release
Version 1.1
- Added option to set death delay time to 0 to simply block the suicide command and not allow players to use the suicide.
Version 1.2 (if you update from older version, delete the old config file and let the plugin create a new one)
- Applied KyleS' suggestions regarding the FindConVar
- Added min 0 and max 1 to sm_suicideintercept_enabled
- Added ability to modify the settings while in game (enable or disable it, change the death time)
- Updated description to include ability to block the suicide command
Version 1.2a (if you update from older version, delete the old config file and let the plugin create a new one)
- Cleaned up the code a bit and fixed the bool for enabling the plugin.
Version 1.3
- Removed config file dependancy - just set your CVars in the sourcemod.cfg if you need to change any of them
- Added translation file so this plugin is no longer hard coded with english messages
Version 1.3a
- Added
exvel's
[INC] Colors (1.0.5)
Version 1.4
- As brought up by wazzgod, there is a bug with using the commands suicide or jointeam, so I removed those commands from being hooked. Now, only "kill" "explode" and "joinclass" are captured and delayed.
- Changed default flag for allow_suicide from CUSTOM1 to ROOT.
Version 1.4a
- Added back the hooks for "jointeam" and "spectate". Now if a player types one of those, it will delay it (if you have it set to) by X seconds, then after that time is up, it will perform the action of either of those commands (move them to spectate, or bring up the team selection menu).
- I added a few more entries in the translations file, so you'll have to get the new SuicideIntercept.phrases.txt if you are going to use this version.
- I changed the admin_overrides.cfg entry from allow_suicide to "bypass_suicideintercept". By default, ROOT admins can use the commands without the delay. If you want other flags to bypass this plugin, just add their flags to the command
"bypass_suicideintercept"
Version 1.4b
- Fixed janky translation file - now it has proper variables :)
* You need the newly upload translation file with the new smx
Version 1.5
- Redesigned the code to be cleaner and more effecient
* Fixed the bad Int of -1 in convars :oops:
* Added new cvars to allow configuration of blocking the "kill", "explode", "spectate", "jointeam", and "joinclass" commands
- Reworked some of the code so it keeps itself clean
Version 1.5.1
- Added Updater capability
Version 1.5.2
- Removed requirement for cstrike
- This plugin works on TF2 - confirmed
Version 1.5.3
- Added flag FCVAR_DONTRECORD to plugin version CVar
- Added CVar for Updater - defaulted to off
- Commented some more of the code
Version 1.5.4
- Added timer to ignore suicide commands by player for n seconds after player spawn (by request) - disabled by default
- Added bool for checks if plugin is enabled or not for the console commands
- Modified the variable in the translation file so it doesn't print so many 0's in the delay notification
Version 1.5.5
* Fixed error: Native "IsPlayerAlive" reported: Client # is not in game
NOTES:
You'll have to download the attached .smx file because the web compiler cannot compile due to the <colors> include.
I've attached that .inc file as well if you want to recompile yourself.
Version 1.5.6
+ Added ability to disable immunity
UPGRADING?
You'll need to get the updated translation file as well - I've added a bunch of different phrases in there since 1.4b.
You should backup your config file and let the plugin create a new one, then edit the one it creates since I added a new CVar as of 1.5.6
If you have Updater, the plugin will auto-update itself if you have the CVar set to 1