Raised This Month: $51 Target: $400
 12% 

TF2 No self damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
outsiderlv
Senior Member
Join Date: Mar 2010
Old 07-08-2011 , 15:21   TF2 No self damage
Reply With Quote #1

How to disable self damage from weapons.
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(
attacker && attacker <= MaxClients && victim == attacker)
    {
        
        new 
health GetClientHealth(victim);
        
SetEntityHealth(victim,health);
        
        return 
Plugin_Changed;
    }
    return 
Plugin_Changed;

That didnt work..
outsiderlv is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-08-2011 , 15:51   Re: TF2 No self damage
Reply With Quote #2

SourceMod's API doesn't have an OnTakeDamage. Where are you getting this from?
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
outsiderlv
Senior Member
Join Date: Mar 2010
Old 07-08-2011 , 15:58   Re: TF2 No self damage
Reply With Quote #3

SDK Hooks
outsiderlv is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-08-2011 , 16:28   Re: TF2 No self damage
Reply With Quote #4

Quote:
Originally Posted by outsiderlv View Post
SDK Hooks
And you remembered to use
PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);

to wire that up?
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-08-2011 at 16:31.
Powerlord is offline
Cookies.net
Senior Member
Join Date: Jan 2011
Old 07-08-2011 , 16:42   Re: TF2 No self damage
Reply With Quote #5

Wouldn't this work?
PHP Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(
victim == attacker)
    {
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;

Cookies.net is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 07-08-2011 , 19:27   Re: TF2 No self damage
Reply With Quote #6

Code:
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(attacker > 0 && attacker <= MaxClients && victim == attacker)
    {
        damage = 0;
        return Plugin_Changed;
    }

    return Plugin_Continue;
} 

__________________
pheadxdll is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 07-09-2011 , 03:25   Re: TF2 No self damage
Reply With Quote #7

Code:
SetEntProp(client, Prop_Data, "m_takedamage", 1, 1);
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
outsiderlv
Senior Member
Join Date: Mar 2010
Old 07-09-2011 , 05:17   Re: TF2 No self damage
Reply With Quote #8

Not working.. :/
outsiderlv is offline
Cookies.net
Senior Member
Join Date: Jan 2011
Old 07-09-2011 , 05:25   Re: TF2 No self damage
Reply With Quote #9

Quote:
Originally Posted by outsiderlv View Post
Not working.. :/
What isn't working? Show us some more code so we can track your issues? It's a bit difficult to work with "Not working" if we don't know what you did wrong

Also, did you do what Powerlord said?
PHP Code:
public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);

Cookies.net is offline
ojmdk476oj
AlliedModders Donor
Join Date: Dec 2009
Old 07-09-2011 , 06:39   Re: TF2 No self damage
Reply With Quote #10

Try this?
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 
}   

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype
{
    if(
attacker == victim)
        return 
Plugin_Handled
        
    return 
Plugin_Continue;

ojmdk476oj 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 21:41.


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