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

Push player away from entity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ms. Trooper
Senior Member
Join Date: Nov 2012
Old 06-20-2015 , 06:43   Push player away from entity?
Reply With Quote #1

I want to push a player away from an entity. So far I have:
Code:
new EntPos[3];
        GetEntDataVector(Ent, "m_vecOrigin", EntPos);
        
        new PlayerPos[3];
        GetEntDataVector(Player, "m_vecOrigin", PlayerPos);
        
        new VectorBetween;
        MakeVectorFromPoints(PlayerPos, VEntPos, VectorBetween);

        //something goes here

        TeleportEntity(Player, NULL_VECTOR, NULL_VECTOR, vecVelocity);
I'm guessing that MakeVectorFromPoints returns origin+angle, and I don't know how to turn angle into velocity (coordinate based). Please help. Thanks!

Last edited by Ms. Trooper; 06-20-2015 at 06:45.
Ms. Trooper is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 06-20-2015 , 07:30   Re: Push player away from entity?
Reply With Quote #2

Try this (not tested)
PHP Code:
new Float:EntPos[3];
GetEntDataVector(Ent"m_vecOrigin"EntPos);

new 
Float:PlayerPos[3];
GetClientAbsOrigin(PlayerPlayerPos);

new 
Float:vecVelocity[3];
MakeVectorFromPoints(EntPosPlayerPosvecVelocity);
NormalizeVector(vecVelocityvecVelocity);
ScaleVector(vecVelocity250.0); // push speed here

TeleportEntity(PlayerNULL_VECTORNULL_VECTORvecVelocity); 
KissLick 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 01:30.


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