Code:
#define MAX_SPHERE_RADIUS 200
#define MIN_SPHERE_RADIUS 0
#define ORIGIN_POWER 10
public explosion_jump(id,level,cid) {
new wepid,temp1,temp2;
wepid = get_user_weapon(id,temp1,temp2); // checking if the attacker's using an usp.
if ( !cmd_access(id, level, cid, 1) || !(pev(id, pev_button) & IN_ATTACK) || wepid != 16 || read_data(3) < 1)
return PLUGIN_HANDLED;
new origin_player[3], origin_bullet[3];
new power, pl_bullet_distance;
new Float:velocity[3];
get_user_origin(id, origin_player, 0);
get_user_origin(id, origin_bullet, 3);
pl_bullet_distance = get_distance(origin_player, origin_bullet);
if ( pl_bullet_distance > MAX_SPHERE_RADIUS || pl_bullet_distance < MIN_SPHERE_RADIUS)
return PLUGIN_HANDLED;
power = -1 * ORIGIN_POWER * ( MAX_SPHERE_RADIUS - pl_bullet_distance );
velocity_by_aim ( id, power, velocity )
set_pev(id,pev_velocity, velocity);
return PLUGIN_HANDLED;
}
public plugin_init() {
register_plugin("Power Jump","0.01","Salepate");
register_event("CurWeapon","explosion_jump","be","1=1");
}
This worked pretty nice. The power calculation is a bit linear, so you end up flying pretty high if you shoot right near your feet. You could take the square root of the stuff in parenthesis and that may give it a more natural feeling drop-off.