Raised This Month: $ Target: $400
 0% 

Push, or Attract


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 11-10-2009 , 14:06   Push, or Attract
Reply With Quote #1

PHP Code:
// Attacker origin
static Float:flOrigin[3]
entity_get_vector(iAttackerEV_VEC_originflOrigin)

// Victim origin
static Float:flDirection[3]
entity_get_vector(iVictimEV_VEC_originflDirection)

// Subtract vector
xs_vec_sub(flDirectionflOriginflDirection)

// Normalize vector
xs_vec_normalize(flDirectionflDirection)

// Get victim's velocity
get_user_velocity(iVictimflVelocity)

// Multiply direction by Punch force
xs_vec_mul_scalar(flDirectionget_pcvar_float(cvar_punchforce), flDirection)

// Apply vector direction
xs_vec_add(flVelocityflDirectionflVelocity)

// Punch it!
set_user_velocity(iVictimflVelocity
If this code is used to "Push" an entity, as it would be to "Attract" an entity?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross

Last edited by meTaLiCroSS; 11-10-2009 at 14:13.
meTaLiCroSS is offline
 



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 13:39.


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