Lets give you an idea:
Code:
new Float:explosion_origin[3] // Var which will hold the origin where you want the explosion to take
// Retrieve player's origin
new Float:player_origin[3]
pev( id, pev_origin, player_origin )
// We will get a vector pointing from explosion's origin towards the player
// eg: we always get a vector from point.A to point.B if we substract point.A's origin from point.B's origin.
new Float:player_vector[3]
player_vector[0] = player_origin[0] - explosion_origin[0]
player_vector[1] = player_origin[1] - explosion_origin[1]
player_vector[2] = player_origin[2] - explosion_origin[2]
// We normalize the vector. Basically a normalized vector is vector with a length of 1 unit
xs_vec_normalize( player_vector, player_vector )
// Now you can increase the vector's magnitude according to the player's distance from the origin (you can change its magnitude (length) by multipling it by a scalar)
For more info you can read this tutorial coz that is how i learned this vector stuff.
https://forums.alliedmods.net/showthread.php?t=91474
__________________