AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   Suicide Intercept (https://forums.alliedmods.net/showthread.php?t=163257)

TnTSCS 07-28-2011 09:45

Suicide Intercept
 
4 Attachment(s)
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.

CVARS


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

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

KyleS 07-28-2011 11:40

Re: [CS:S] Suicide Intercept
 
Nice plugin. It would be cool if sm_suicideintercept_delaydeathtime was set to 0 that the plugin just blocks the commands.

EDIT: Also, the FindConVar's are kind of wrong since CreateConVar returns a Handle to the ConVar.

Powerlord 07-28-2011 13:01

Re: [CS:S] Suicide Intercept
 
Is this available for other games too, or just CS:S?

I'm asking more for others than myself, as the only Source game I host (Team Fortress 2) awards kills for suicides (and environment deaths in general) to the last person to damage a person before they die.

Incidentally, this plugin would be useless in TF2 for that very reason.

TnTSCS 07-28-2011 17:50

Re: [CS:S] Suicide Intercept
 
Quote:

Originally Posted by KyleS (Post 1520449)
Nice plugin. It would be cool if sm_suicideintercept_delaydeathtime was set to 0 that the plugin just blocks the commands.

EDIT: Also, the FindConVar's are kind of wrong since CreateConVar returns a Handle to the ConVar.

have a setting of 0 is a good idea - I'll get that in there.

I'll look at the FindConVar's to see if I can see what you're talking about - I might need a little direction

...:: TnT Edit ::...
Are you talking about this part?:
PHP Code:

    g_pluginEnabled FindConVar("sm_suicideintercept_enabled");
    
g_delay_death_time FindConVar("sm_suicideintercept_delaydeathtime"); 

Should it just be
PHP Code:

g_pluginEnabled CreateConVar("sm_suicideintercept_enabled""1""Is Kill Delay Enabled? 1/0");
g_delay_death_time CreateConVar("sm_suicideintercept_delaydeathtime""7""How many seconds to wait before forcing the suicide on the player who tried to suicide."_true1.0true25.0); 

And I'll put an "if GetConVarInt(g_delay_death_time) is zero then plugin_handled" widget

wazzgod 07-28-2011 20:37

Re: [CS:S] Suicide Intercept
 
Thx for all your hard work TnTSCS :)

TnTSCS 07-28-2011 21:57

Re: [CS:S] Suicide Intercept
 
KyleS - ha, I looked at your code and LoL'd

PHP Code:

new Handle:hRandom// I HATE Handles.
    
    
HookConVarChange((hRandom CreateConVar("nt_enabled",                "1",    "Should I even be running?"_true0.0true1.0)),                                                OnEnabledChange);
    
g_bEnabled GetConVarBool(hRandom); 

I HATE HANDLES!! LoL

Caffeinated 08-10-2011 18:36

Re: [CS:S] Suicide Intercept
 
I was curious, were you planning on releasing one where delay death could be set to 0?

TnTSCS 08-10-2011 22:07

Re: [CS:S] Suicide Intercept
 
I'll fix that up right now :)

I'll update the OP when it's done... sorry for the delay

...:: TnT Edit ::...

Updated OP with v1.1 :)

TnTSCS 08-10-2011 23:22

Re: [CS:S] Suicide Intercept
 
You might have to delete the old config file and let the plugin create a new one

KyleS 08-11-2011 03:28

Re: [CS:S] Suicide Intercept
 
Quote:

Originally Posted by TnTSCS (Post 1520642)
Should it just be
PHP Code:

g_pluginEnabled CreateConVar("sm_suicideintercept_enabled""1""Is Kill Delay Enabled? 1/0");
g_delay_death_time CreateConVar("sm_suicideintercept_delaydeathtime""7""How many seconds to wait before forcing the suicide on the player who tried to suicide."_true1.0true25.0); 


Yup :wink:

TnTSCS 08-11-2011 09:09

Re: [CS:S] Suicide Intercept
 
Quote:

Originally Posted by KyleS (Post 1530105)
Yup :wink:

Thank you KyleS. I'll update this later today :) As I'm sure you (and others) are well aware, I'm still a n00b at sourcepawn and have a limited VB background. I do, however, have a pretty good handle on databases (SQL and Oracle), and select statements, but I still have a long way to go with sourcepawn.

I appreciate any help and criticism when it comes to plugins I put up.

TnTSCS 08-11-2011 14:58

Re: [CS:S] Suicide Intercept
 
Updated to 1.2 - if you update, you need to delete the old config file and let the plugin create you a new one.

* Version 1.2
* 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

TnTSCS 08-17-2011 15:10

Re: [CS:S] Suicide Intercept
 
Updated to 1.2a

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.

TnTSCS 09-05-2011 18:43

Re: [CS:S] Suicide Intercept
 
Updated OP with version 1.3a.

Changes include the removal of the config file (just set cvars in sourcemod.cfg or per map config file), cleaned up code more (handles and hookconvarchange) according to KyleS' suggestions, added translations file, and added the colors include.

Check it out and let me know what you think.

...:: TnT Edit ::...
Oh ya, forgot to mention I put in that if you have the "o" flag, you're allowed to use the suicide commands. You can override this in the admin_overrides.cfg using this:
"allow_suicide" "z"

The above would only allow those with ROOT flag to be able to use the suicide command right away.

wazzgod 09-05-2011 19:03

Re: [CS:S] Suicide Intercept
 
Note there is a bug when you type spectate in console.

it waits x var then kills you, but doesnt send you to spectate. you have to type spectate in console again (after your dead) in order for you to switch

Maybe you should add some vars
bla_teamswitch_enable 1
bla_suicide_enable 1

ect so that if a user only wants "kill in console" to be delayed, they dont have to use any of those other features.


Just a idea :P

TnTSCS 09-05-2011 20:00

Re: [CS:S] Suicide Intercept
 
ya... I noticed that if a player legitimately wants to change teams, it kills them after X seconds , but doesn't display the change team screen...

I'll fix that and update the OP in a bit.

Because players can use jointeam and joinclass to commit suicide, I have to keep those in there, but I'll add a cvar to use only "kill and explode" or to use the other three as well... the other three will just delay the action of either spectate or jointeam/class

thoughts?

TnTSCS 09-05-2011 22:37

Re: [CS:S] Suicide Intercept
 
For the time being, I removed the hook for JOINTEAM and SPECTATE.

Updated OP:

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.

TnTSCS 09-06-2011 16:39

Re: [CS:S] Suicide Intercept
 
Added back the JOINTEAM and SPECTATE hooks. See OP for further details.

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"

...:: TnT Edit ::...

Version 1.4b
- Fixed janky translation file - now it has proper variables :)
* You need the newly upload translation file with the new smx

TnTSCS 11-26-2011 23:45

Re: [CS:S] Suicide Intercept
 
Updated this plugin - addressed some issues and added a few cvars. If upgrading, make sure you download and replace the translation file. See the OP for the latest files

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

UPGRADING?
You'll want to delete the old config file (after backing it up) so a new, updated one, will be created. You'll need to get the updated translation file as well - I've added a bunch of different phrases in there since 1.4b.

TnTSCS 12-05-2011 18:13

Re: Suicide Intercept
 
Version 1.5.2
- Removed requirement for cstrike
- This plugin works on TF2 - confirmed

Dr!fter 01-14-2012 11:53

Re: Suicide Intercept
 
Nice plugin.

The only thing i noticed that should be changed is the version cvar flags should have the FCVAR_DONTRECORD so that it isn't written into the config file. Other than that all looks good!

TnTSCS 01-14-2012 12:01

Re: Suicide Intercept
 
okay, I'll update this one as well... I'll post an update today :)

thank you

TnTSCS 01-14-2012 13:38

Re: Suicide Intercept
 
Updated the plugin - if you have Updater it should auto-update, if not, get the new files from the OP

Code:

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


thejuice027 04-27-2012 20:38

Re: Suicide Intercept
 
just one question, If they are already dead, will it still delay? I would install this plugin if it doesn't delay any commands if they are already dead.

TnTSCS 04-27-2012 20:47

Re: Suicide Intercept
 
I believe when they die after trying to suicide, I coded to kill all delayed timers.

thejuice027 04-27-2012 20:49

Re: Suicide Intercept
 
no, i mean, say I kill them with a soilders rocket, then they attempt to switch classes, will they switch immideatly or will they have to wait?

So, die, attempt to switch, what happens?

instead of

attempt to switch, wait, dies and switches.

TnTSCS 04-27-2012 20:50

Re: Suicide Intercept
 
if they're dead, and want to switch classes, it will let them... the class switch will be handled by the game and game rules


This is the first check in the command callback (when a player switches classes, or types a suicide command) and it checks to make sure the player is alive before acting on the command:

PHP Code:

if(client == || !IsPlayerAlive(client) || IsFakeClient(client) || GetClientTeam(client) < 2)
{
    return 
Plugin_Continue;


So, if a player is dead, it allows the player to do anything - joinclass, jointeam, explode, kill, spectate

thejuice027 04-27-2012 20:56

Re: Suicide Intercept
 
well, I want to use this plugin in conjunction with the rtd plugin. I like this plugin because it will stop people from killing themselves when they roll a negative effect. Only problem I see is that it could be frusterating. I also have instant spawn in my server, which doesn't exactly always instantly spawn them, usually takes about 3-4 seconds after dying. If a player spawns then wants to switch but was late because he/she already spawned, then they'll be waiting longer. Is there anyway I can make a request? I was wondering if this could be enabled ONLY during the time a player is rolling (rtd, roll the dice). Or even maybe allow them to swich classes up to after 15 seconds after spawn?

TnTSCS 04-27-2012 20:59

Re: Suicide Intercept
 
Sure, I can add a configurable timer (CVar to set the number of seconds) so that a player can use a suicide command (jointeam, joinclass, spectate, kill, explode) within n seconds after player_spawn.

Give me till the weekend (maybe a few more days) as I have another request I need to fulfill first on another of my plugins, plus I'm out of town till week after next.

thejuice027 04-27-2012 21:04

Re: Suicide Intercept
 
ill be watching.

TnTSCS 04-27-2012 21:48

Re: Suicide Intercept
 
1 Attachment(s)
Here - this is untested, but should work... added a new CVar (sm_suicideintercept_time defaulted to 0) where you can set the number of seconds to allow players to use suicide commands after spawn.

You'll need to compile it yourself with all of the required includes since I'm not home and don't have access to my server - I only edited the sourcecode while sitting here in my hotel room...

Let me know if there are any issues. Hopefully you have a test server :)

Once I get back home, I'll test the plugin and officially release it.

...:: TnT Edit ::...
Oh, turn off auto update for this plugin while using this unofficial release.

Actually, I just uploaded a version that doesn't use updater - go to http://www.sourcemodplugins.org/pages/smwebide/ and upload the .sp file there and it will compile it for you.

thejuice027 04-28-2012 20:01

Re: Suicide Intercept
 
Sweet, I'll be testing it as soon as my server is empty.

thejuice027 04-29-2012 11:11

Re: Suicide Intercept
 
tested. nothing works.

TnTSCS 04-29-2012 11:46

Re: Suicide Intercept
 
Quote:

Originally Posted by thejuice027 (Post 1698703)
tested. nothing works.

the whole plugin is broken? Anything in error logs? I'm going to fire up my server and test it out - home for today, gone all next week :(


...:: TnT Edit ::...

Found the error in the code - it was in the player_spawn event... I had a rogue "!" in the check :)

should be:
if(IsFakeClient(client)) - it was if(!IsFakeClient(client))...

I'll publish an update today.

TnTSCS 04-29-2012 12:47

Re: Suicide Intercept
 
Plugin Updated:

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

------------------

If you have the Updater plugin and have this plugin set to use it, your copy will auto-update soon, otherwise, get the latest files from the OP.

thejuice027 04-30-2012 22:36

Re: Suicide Intercept
 
thanks for the update, will test again as soon as server empty's. My server is getting too popular. lol.
And it's thanks to people like you! so Thanks a bunch!

EDIT: Tested, didn't work.
Deleted plugin and config from server, restarted server, reinstalled plugin again just to be sure it was updated. restarted server. still didn't work.

I also saw nothing relevant in the logs.

thejuice027 05-02-2012 21:02

Re: Suicide Intercept
 
Actually, do you have it set so admins are immune to it? because Some people are telling me it is working, but for me it is not. I am the only one with the z flag.

TnTSCS 05-02-2012 21:20

Re: Suicide Intercept
 
yes:

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



if you want, I can add a CVar to enable/disable the immunity

thejuice027 05-03-2012 00:18

Re: Suicide Intercept
 
Quote:

Originally Posted by TnTSCS (Post 1700848)
yes:

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



if you want, I can add a CVar to enable/disable the immunity

No need, just that when I was trying to test, I did not know this minor detail and I thought it was still broken. Well, since that's not the case, thanks.

St00ne 07-13-2012 05:46

Re: Suicide Intercept
 
Hi TnTSCS,

Thanks for this plugin.

I have just one error log on my linux cs:s sever, using sm 1.4.4 stable version:

Code:

L 07/08/2012 - 16:19:20: SourceMod error session started
L 07/08/2012 - 16:19:20: Info (map "ka_soccer_snow_v4") (file "errors_20120708.log")
L 07/08/2012 - 16:19:20: [SM] Native "IsPlayerAlive" reported: Client 10 is not in game
L 07/08/2012 - 16:19:20: [SM] Displaying call stack trace for plugin "SuicideIntercept.smx":
L 07/08/2012 - 16:19:20: [SM]  [0]  Line 259, C:\Sourcemod\TnTSCS\scripting\SuicideIntercept.sp::Command_InterceptSuicide()
L 07/08/2012 - 17:03:03: Error log file session closed.

Could you have a look? Please ask me if you need more info.

Regards,

St00ne


All times are GMT -4. The time now is 10:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.