Raised This Month: $ Target: $400
 0% 

Adding to velocity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 12-22-2005 , 20:57   Adding to velocity
Reply With Quote #1

What Im trying to do, is give a player a 'boost' in the direction they are moving. So if theyre moving backwards, this will boost them backwards, if they are moving diagonally backwards, but looking forwards, they will get a boost in that direction, same for any direction. So no matter which way they are moving, regardless of direction, they will get a boos. tBut I believe I have made a mistake when actually 'giving' them the boost.

Example, if a player is running forwards, and uses this boost, they will get a boost forwards, but if they use it again almost straight after, they get an unnecessary boost towards their left or right, causing them to go more sideways, than forwards.

I just want to know, how I can give them a boost in the direction they are moving only.

Code:
 #include <amxmodx>  #include <amxmisc>  #include <engine>    public plugin_init() {     register_plugin("Boost","0.3","Willmaker")     register_clcmd("boost","boost") }  public boost(id){     new Float: Velocity[3]     new Float: Speed = (Velocity[0] + Velocity[1])     entity_get_vector(id, EV_VEC_velocity, Velocity)     set_hudmessage(255, 255, 255, 0.02, 0.15, 0, 0.0, 5.0)     show_hudmessage(id, "^nVelocity^nX: %i Y: %i Z: %i", Velocity[0], Velocity[1], Velocity[2])     if (-80 < Velocity[2] < 80) {         if (500 > Speed > -500 ){             Velocity[0] = (Velocity[0] * 10)             Velocity[1] = (Velocity[1] * 10)             entity_set_vector(id, EV_VEC_velocity, Velocity)         }     }     return PLUGIN_HANDLED }
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
 



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 15:51.


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