Raised This Month: $ Target: $400
 0% 

Pushing someone away


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Speed!
BANNED
Join Date: Jan 2009
Old 02-13-2009 , 12:53   Re: Pushing someone away
Reply With Quote #3

Quote:
Originally Posted by Exolent[jNr] View Post
Code:
// minimum radius for player to be pushed away #define PUSH_RADIUS 200.0 // maximum speed for player to be pushed away // (maximum speed will be used if player is closest to the origin, otherwise it is proportional to the player's distance) #define PUSH_SPEED 500.0 PushPlayer(client, const Float:center[3]) {     new Float:origin[3];     pev(client, pev_origin, origin);         new Float:dist = get_distance_f(origin, center);     if( dist > PUSH_RADIUS ) return;         new Float:speed = (1.0 - (dist / PUSH_RADIUS)) * PUSH_SPEED;         new Float:velocity[3];     velocity[0] = origin[0] - center[0];     velocity[1] = origin[1] - center[1];     velocity[2] = origin[2] - center[2];         new Float:length = vector_length(velocity);         velocity[0] = velocity[0] / length * speed;     velocity[1] = velocity[1] / length * speed;     velocity[2] = velocity[2] / length * speed;         new Float:current[3];     pev(client, pev_velocity, current);         current[0] += velocity[0];     current[1] += velocity[1];     current[2] += velocity[2];         set_pev(client, pev_velocity, current); }
Speed! is offline
 



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 16:58.


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