Raised This Month: $ Target: $400
 0% 

TF2 No self damage


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

DONE! Thanks everybody.
Oh no, soldiers dont get hit up anymore.. <_< How to fix it?

Last edited by outsiderlv; 07-10-2011 at 10:57.
outsiderlv is offline
ojmdk476oj
AlliedModders Donor
Join Date: Dec 2009
Old 07-10-2011 , 12:03   Re: TF2 No self damage
Reply With Quote #12

Try this (don't know if it works, since i have never run a TF2 server and, i'm pretty bad at coding.. : /):

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)
    {
        
damage 0.0;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue


Last edited by ojmdk476oj; 07-10-2011 at 12:44. Reason: Wrong code..
ojmdk476oj is offline
outsiderlv
Senior Member
Join Date: Mar 2010
Old 07-11-2011 , 07:26   Re: TF2 No self damage
Reply With Quote #13

This didnt work..
outsiderlv is offline
ojmdk476oj
AlliedModders Donor
Join Date: Dec 2009
Old 07-11-2011 , 12:56   Re: TF2 No self damage
Reply With Quote #14

This should work:

PHP Code:
#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 

new old_health[MAXPLAYERS+1];

public 
OnClientPutInServer(client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);  
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)  
{
    if (!
attacker || attacker MaxClients)
        return 
Plugin_Continue;

    if(
attacker == victim)
    {
        
old_health[attacker] = GetClientHealth(attacker);
        
CreateTimer(0.00001healthattacker)
    }
        
    return 
Plugin_Continue;
}

public 
Action:health(Handle:timerany:attacker)
{
    
SetEntProp(attackerProp_Send"m_iHealth"old_health[attacker]);
    return 
Plugin_Stop;

Tried other things, but something happens when you jump and then shoot down? Don't know, but this should work ;)
ojmdk476oj is offline
slate_chris
New Member
Join Date: May 2010
Old 12-13-2011 , 13:12   Re: TF2 No self damage
Reply With Quote #15

Quote:
Originally Posted by johan123jo View Post
This should work:

PHP Code:
#include <sourcemod> 
#include <sdktools> 
#include <sdkhooks> 

new old_health[MAXPLAYERS+1];

public 
OnClientPutInServer(client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);  
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)  
{
    if (!
attacker || attacker MaxClients)
        return 
Plugin_Continue;

    if(
attacker == victim)
    {
        
old_health[attacker] = GetClientHealth(attacker);
        
CreateTimer(0.00001healthattacker)
    }
        
    return 
Plugin_Continue;
}

public 
Action:health(Handle:timerany:attacker)
{
    
SetEntProp(attackerProp_Send, &quot;m_iHealth&quot;, old_health[attacker]);
    return 
Plugin_Stop;

Tried other things, but something happens when you jump and then shoot down? Don't know, but this should work ;)
That will give you the health you had prior to damaging yourself, but you can still die, correct?

any way to make it work that you don't take damage at all but can still rocketjump?

i tried playing around with:
sm_cvar tf_damageforcescale_self_soldier_rj
sm_cvar tf_damagescale_self_soldier

which does the job for actual rocketjumping, but you can still damage yourself when you're not airborne.

Is there really no way to achive the complete removal of selfdamage?

Last edited by slate_chris; 12-13-2011 at 13:13.
slate_chris is offline
spunkster21
Senior Member
Join Date: Aug 2008
Old 12-19-2011 , 08:17   Re: TF2 No self damage
Reply With Quote #16

Quote:
Originally Posted by slate_chris View Post
That will give you the health you had prior to damaging yourself, but you can still die, correct?

any way to make it work that you don't take damage at all but can still rocketjump?

i tried playing around with:
sm_cvar tf_damageforcescale_self_soldier_rj
sm_cvar tf_damagescale_self_soldier

which does the job for actual rocketjumping, but you can still damage yourself when you're not airborne.

Is there really no way to achive the complete removal of selfdamage?
The only way I got this working was to use sdkhooks to set damage to zero then obtain the client's velocity and origin, manipulate them and use teleport entity. This method takes a little bit of fiddling to get right as you can massively increase or decrease the rocket jumping vertical and horizontal forces. Your end product would be something like:

PHP Code:
TeleportEntity(clientNULL_VECTORNULL_VECTORvelocity
I'd also be interested if anyone knows a better method for achieving this.

Clearly the tricky part is getting the velocity correct.
spunkster21 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 11:22.


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