Raised This Month: $ Target: $400
 0% 

A virtual sphere to eject player.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AndraX2000
Member
Join Date: Mar 2006
Location: 39°57' N 83°14' W
Old 01-06-2007 , 20:41   Re: A virtual sphere to eject player.
Reply With Quote #1

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.
__________________
Get maps at http://www.counter-strike-maps.net
Shoot me at:

AndraX2000 is offline
Reply



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 22:19.


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