PHP Code:
// Attacker origin
static Float:flOrigin[3]
entity_get_vector(iAttacker, EV_VEC_origin, flOrigin)
// Victim origin
static Float:flDirection[3]
entity_get_vector(iVictim, EV_VEC_origin, flDirection)
// Subtract vector
xs_vec_sub(flDirection, flOrigin, flDirection)
// Normalize vector
xs_vec_normalize(flDirection, flDirection)
// Get victim's velocity
get_user_velocity(iVictim, flVelocity)
// Multiply direction by Punch force
xs_vec_mul_scalar(flDirection, get_pcvar_float(cvar_punchforce), flDirection)
// Apply vector direction
xs_vec_add(flVelocity, flDirection, flVelocity)
// Punch it!
set_user_velocity(iVictim, flVelocity)
If this code is used to "Push" an entity, as it would be to "Attract" an entity?
__________________