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

Solved [TF2] Do damage to friend


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oplkill
Member
Join Date: Aug 2015
Old 01-10-2018 , 14:29   [TF2] Do damage to friend
Reply With Quote #1

How to deal damage via SDKHooks_TakeDamage or another script functions to friend?
When i using SDKHooks_TakeDamage to friend its not working...(when attacker and attacking players in one team)

PHP Code:
new Float:flPos1[3];
GetClientAbsOrigin(clientflPos1);
    
for(new 
i=1i<=MaxClientsi++)
{
    if(
!= client && IsClientInGame(i) && IsPlayerAlive(i))
    {
        new 
Float:flPos2[3];
        
GetClientAbsOrigin(iflPos2);
                
        new 
Float:flDistance GetVectorDistance(flPos1flPos2);
        if(
flDistance <= 999.0)
        {
            
SDKHooks_TakeDamage(i0client500.0DMG_PREVENT_PHYSICS_FORCE|DMG_CRUSH|DMG_ALWAYSGIB);
        }
    }


Last edited by oplkill; 01-13-2018 at 11:03.
oplkill is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 01-11-2018 , 12:51   Re: [TF2] Do damage to friend
Reply With Quote #2

Your code at a glance seems like it should work as you intended it to work, any other details that can be given?
Drixevel is offline
oplkill
Member
Join Date: Aug 2015
Old 01-12-2018 , 13:01   Re: [TF2] Do damage to friend
Reply With Quote #3

Thats all code.
This code using to take damage to all around one player(in 999.0 radius), to enemies and friends. I actually can do damage to friends as a 0 attacker
PHP Code:
SDKHooks_TakeDamage(i00500.0DMG_PREVENT_PHYSICS_FORCE|DMG_CRUSH|DMG_ALWAYSGIB); 
But in kill-window(where showing who kill somebody) thats will be shown like thats player do suicide or "fall down" from map...

I just wanted that in kill-window will showed friend kill, like in screenshot
oplkill is offline
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 01-13-2018 , 04:44   Re: [TF2] Do damage to friend
Reply With Quote #4

Add one more parameter to Sdkhooks_takedamage and pass the entindex of your active weapon.
Getting active weapon:
GeEntPropEnt(client, Prop_Send, m_hActiveWeapon");
__________________
My plugins:
*None for now*


Steam:
naydef

Last edited by Naydef; 01-13-2018 at 04:45.
Naydef is offline
oplkill
Member
Join Date: Aug 2015
Old 01-13-2018 , 10:36   Re: [TF2] Do damage to friend
Reply With Quote #5

Still don't working
PHP Code:
new wep GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
...
SDKHooks_TakeDamage(i0client500.0DMG_PREVENT_PHYSICS_FORCE|DMG_CRUSH|DMG_ALWAYSGIBwep); 
oplkill is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 01-13-2018 , 10:41   Re: [TF2] Do damage to friend
Reply With Quote #6

PHP Code:
FindConvar("mp_friendlyfire").SetBool(true);
SDKHooks_TakeDamage(i0client500.0DMG_PREVENT_PHYSICS_FORCE|DMG_CRUSH|DMG_ALWAYSGIB);
FindConvar("mp_friendlyfire").SetBool(false); 
__________________

Last edited by Pelipoika; 01-13-2018 at 10:41.
Pelipoika is offline
oplkill
Member
Join Date: Aug 2015
Old 01-13-2018 , 10:50   Re: [TF2] Do damage to friend
Reply With Quote #7

That's working!
There the solution to hide messages about changing cvar:

PHP Code:
new Handle:cvar FindConVar("mp_friendlyfire");
SetConVarFlags(cvarGetConVarFlags(cvar) & ~FCVAR_NOTIFY);
CloseHandle(cvar); 

Last edited by oplkill; 01-13-2018 at 11:03.
oplkill 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:36.


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