View Single Post
a2121858
Member
Join Date: Sep 2020
Old 09-17-2021 , 22:31   Re: [L4D2]How to add damage sources to flying objects (containers, cars, truck)
Reply With Quote #9

Quote:
Originally Posted by Silvers View Post
Yeah, where are you putting the code?

Edit: I do this in one of my plugins:
PHP Code:
elay)
{
    
SetEntPropEnt(entityProp_Data"m_hPhysicsAttacker"client);
    
SetEntPropFloat(entityProp_Data"m_flLastPhysicsInfluenceTime"GetGameTime()); 
I think that last line might be required, I see it in a few of mine like this.
I did this, before moving the object.
PHP Code:
float f_Velocity[3], f_Power;

GetAngleVectors(f_Anglesf_VelocityNULL_VECTORNULL_VECTOR);
f_Power g_h_CvarChargerPower.FloatValue;
f_Velocity[0] *= f_Power;
f_Velocity[1] *= f_Power;
f_Velocity[2] *= f_Power;
SetEntPropEnt(i_TargetProp_Data"m_hPhysicsAttacker"i_Client); 
TeleportEntity(i_TargetNULL_VECTORNULL_VECTORf_Velocity); 
I will try the new method later, thank you.
a2121858 is offline