Raised This Month: $ Target: $400
 0% 

Disable Sucides


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oneshot23
Senior Member
Join Date: Feb 2009
Old 07-23-2009 , 01:35   Disable Sucides
Reply With Quote #1

Hey i wanted to know if there is a plugin out or if someone could make a plugin that could disable sucides. I think this would be a great idea!
oneshot23 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-23-2009 , 08:08   Re: Disable Sucides
Reply With Quote #2

PHP Code:
#include <sourcemod>
public OnPluginStart() {
    
RegConsoleCmd("kill"BlockCommand);
    
RegConsoleCmd("explode"BlockCommand);
}
public 
Action:BlockCommand(clientargs) {
    return 
Plugin_Handled;

psychonic is offline
olj
Veteran Member
Join Date: Jun 2009
Old 07-23-2009 , 10:42   Re: Disable Sucides
Reply With Quote #3

What kind of suicides? If you talking about jumping from roof of a highscrapper, you cant block this unless you build barricade or disable jump command. If you talking about kill command use code above.
olj is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-23-2009 , 13:09   Re: Disable Sucides
Reply With Quote #4

you can hook player_death and check if attacker and victim are the same or if victim is invaild, then he suicided.
Gachl is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-23-2009 , 15:19   Re: Disable Sucides
Reply With Quote #5

Quote:
Originally Posted by Gachl View Post
you can hook player_death and check if attacker and victim are the same or if victim is invaild, then he suicided.
But that wouldn't have a way to "disable" the suicide as the event is fired after the suicide happens.
psychonic is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-24-2009 , 04:18   Re: Disable Sucides
Reply With Quote #6

then hook in in PRE mode and set the damage dealt to 0 or return plugin_handled
Gachl is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-24-2009 , 04:25   Re: Disable Sucides
Reply With Quote #7

like this:
PHP Code:
#include <sourcemod>

public Plugin:myinfo 
{
    
name "Anti Suicide",
    
author "GachL",
    
description "Stop players from suiciding",
    
version "1.0",
    
url "http://bloodisgood.org"
}

public 
OnPluginStart()
{
    
HookEvent("player_death"cPlayerDeathEventHookMode_Pre);
}

public 
Action:cPlayerDeath(Handle:hEvent, const String:sName[], bool:bDontBroadcast)
{
    new 
iAttacker GetClientOfUserId(GetEventInt(hEvent"attacker"));
    new 
iVictim GetClientOfUserId(GetEventInt(hEvent"userid"));
    if ((
iAttacker == iVictim) || (iVictim == 0))
    {
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

I don't know if it works but imo it should.
Gachl is offline
Theme97
Senior Member
Join Date: Mar 2009
Old 07-24-2009 , 05:32   Re: Disable Sucides
Reply With Quote #8

Quote:
Originally Posted by Gachl View Post
like this:

[snip]

I don't know if it works but imo it should.
I don't think so.

Last time I tried it, blocking player_death only stopped the notification from showing up, and based on the definition of game events, that's exactly how it should be.

To prevent suicide by damage, you'll need to block the damage itself.
Theme97 is offline
Gachl
BANNED
Join Date: Feb 2009
Old 07-24-2009 , 05:42   Re: Disable Sucides
Reply With Quote #9

then hook tick (or think or what it's called) and player_hurt and save all players health each tick and check in player_hurt if attacker and victim are the same or attacker is 0 AND remaining healt <= 0 and set remaining health to the last saved value if so, then you can still hurt yourself but not kill.
Gachl is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-24-2009 , 07:42   Re: Disable Sucides
Reply With Quote #10

Quote:
Originally Posted by Gachl View Post
then hook tick (or think or what it's called) and player_hurt and save all players health each tick and check in player_hurt if attacker and victim are the same or attacker is 0 AND remaining healt <= 0 and set remaining health to the last saved value if so, then you can still hurt yourself but not kill.
That still wouldn't help on a falling-to-death situtation as the hurt would be taking all of their health away.

You can; however, do a prehook on TakeDamage using an extension like Hacks, Hooker, or Dukehacks.
psychonic is offline
Reply



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 16:57.


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