Quote:
Originally Posted by Natsheh
this is kind bad calculations show what is fl_Time is equal to... or atleast the calculation function.
i'm certain there's a better way to achieve such thing.
Edit : Try this :
PHP Code:
#include <amxmodx> #include <fakemeta> #include <xs>
#define VERSION "1.0" #define AUTHOR "Natsheh"
player_explosion_knockback(victim, Float:fExpOrigin[3], Float:fExpShockwaveRadius=500.0, Float:fExpShockwavePower=500.0) { new Float:fOrigin[3], Float:fDistVec[3]; pev(victim, pev_origin, fOrigin); xs_vec_sub(fExpOrigin, fOrigin, fDistVec); new Float:g_fTemp; // victim is in the range of the shockwave explosion! if((g_fTemp=xs_vec_len(fDistVec)) <= fExpShockwaveRadius) { new Float:fPower = fExpShockwavePower * ( 1.0 - ( g_fTemp / floatmin(fExpShockwaveRadius) ) ), Float:fVelo[3], Float:fKnockBackVelo[3]; pev(victim, pev_velocity, fVelo); xs_vec_normalize(fDistVec, fKnockBackVelo); xs_vec_mul_scalar(fKnockBackVelo, fPower, fKnockBackVelo); xs_vec_add(fVelo, fKnockBackVelo, fVelo); set_pev(victim, pev_velocity, fVelo); } }
|
Never mind i got more problems so i decided to use x = ((distance/max)-1.0)*(-1.0) but also didn t work great. the velocity would have been equal to speed * x.
I tried to get a invers-proportional value from 0 to 1.0 that based on the distance of the player on bomb, did work but not as expected since only on 0 would kick you great.
fl_Time was equal to get_distance_f(EntOrigin, VicOrigin) / speed.
So, what was the problem in my calculation? I think it is perfect rn and works great, i will also try yours because it may be better but the thing is, it's kinda hilarious that i could do that thing without these xs natives.
Edit: yours didn't work at all...