Raised This Month: $ Target: $400
 0% 

I want to get velocity by viewangle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hzqst
Senior Member
Join Date: Jul 2008
Old 12-21-2008 , 07:48   I want to get velocity by viewangle
Reply With Quote #1

but doesn't work
Quote:
if(buttons & IN_MOVELEFT){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, 0.0, -600.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
if(buttons & IN_MOVERIGHT){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, 0.0, 600.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
if(buttons & IN_FORWARD){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, 600.0, 0.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
if(buttons & IN_BACK){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, -600.0, 0.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
Quote:
stock ckrun_VecAdd(Float:vec1[3], Float:vec2[3]){
vec1[0] += vec2[0]
vec1[1] += vec2[1]
vec1[2] += vec2[2]
return 1
}

Last edited by hzqst; 12-21-2008 at 07:57.
hzqst is offline
LagParty
Junior Member
Join Date: Jul 2008
Old 12-21-2008 , 15:04   Re: I want to get velocity by viewangle
Reply With Quote #2

as seen in holoduke plugin by vet:
PHP Code:
new Float:Vel1[3], Float:Vel2[3]
velocity_by_aim(id,module,Vel1//module is how fast you want it to be
pev(id,pev_velocity,Vel2)
Vel2[0] += Vel1[0]
Vel2[1] += Vel1[1]
Vel2[2] += Vel1[2]
set_pev(id,pev_velocity,Vel2
does that help?

Last edited by LagParty; 12-21-2008 at 15:06.
LagParty is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 12-22-2008 , 05:53   Re: I want to get velocity by viewangle
Reply With Quote #3

i meant move left or right not forward
hzqst is offline
Old 12-22-2008, 09:27
Dores
This message has been deleted by Dores. Reason: Fine.
hzqst
Senior Member
Join Date: Jul 2008
Old 12-22-2008 , 10:42   Re: I want to get velocity by viewangle
Reply With Quote #4

-_-if i need the code that makes the player move left or right?with pev_velocity
hzqst is offline
Old 12-22-2008, 11:17
Dores
This message has been deleted by Dores. Reason: Fine.
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-22-2008 , 11:31   Re: I want to get velocity by viewangle
Reply With Quote #5

The velocity_by_aim native calculates the player's velocity according to the determined speed and the player's view angles. So I used the player's maxspeed to determine his velocity while walking.

As you asked:
Quote:
Originally Posted by hzqst
I want to get velocity by viewangle
That's what velocity_by_aim does.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 12-31-2008 , 05:33   Re: I want to get velocity by viewangle
Reply With Quote #6

wow awesome. did you solve the problem? i was trying to do that too. Can anyone tell how it's beeing done?

+karma
cs1.7 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 12-31-2008 , 17:41   Re: I want to get velocity by viewangle
Reply With Quote #7

http://forums.alliedmods.net/showpos...60&postcount=5
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-01-2009 , 00:30   Re: I want to get velocity by viewangle
Reply With Quote #8

How do you use velocity_by_aim to move left (IN_MOVELEFT), right (IN_MOVERIGHT), back (IN_BACK) etc.?

I've been trying that for a some time: Question about noclip #5


could you post an example how to use velocity_by_aim for IN_MOVELEFT ?


Code:
if(buttons & IN_MOVELEFT){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, 0.0, -600.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
cs1.7 is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 01-01-2009 , 08:03   Re: I want to get velocity by viewangle
Reply With Quote #9

Quote:
Originally Posted by cs1.7 View Post
How do you use velocity_by_aim to move left (IN_MOVELEFT), right (IN_MOVERIGHT), back (IN_BACK) etc.?

I've been trying that for a some time: Question about noclip #5


could you post an example how to use velocity_by_aim for IN_MOVELEFT ?


Code:
if(buttons & IN_MOVELEFT){
pev(id, pev_v_angle, vangle)
engfunc(EngFunc_AngleVectors, vangle, 0.0, -600.0, 0.0)
ckrun_VecAdd(velocity, vangle)
}
Code:
#include <amxmodx> #include <fakemeta> #define VERSION "1.0" public plugin_init() {     register_plugin( "Right Left Forward Backward Velocity", VERSION, "Dores" );         register_forward( FM_PlayerPreThink, "Forward_PreThink" ); } public Forward_PreThink( id ) {     if( !is_user_alive( id ) )         return FMRES_IGNORED;         new Float:vAngles[ 3 ], Float:flRight[ 3 ], Float:flForward[ 3 ];     pev( id, pev_v_angle, vAngles );     angle_vector( vAngles, ANGLEVECTOR_RIGHT, flRight );     angle_vector( vAngles, ANGLEVECTOR_FORWARD, flForward );         new Float:maxspeed, Float:flVeloc[ 3 ];     pev( id, pev_maxspeed, maxspeed );     velocity_by_aim( id, floatround( maxspeed ), flVeloc );         static Buttons ; pev( id, pev_button, Buttons );         if( Buttons & IN_FORWARD )     {                 flForward[ 0 ] *= flVeloc[ 0 ];         flForward[ 1 ] *= flVeloc[ 1 ];         flForward[ 2 ] *= flVeloc[ 2 ];         set_pev( id, pev_velocity, flForward );     }         if( Buttons & IN_RIGHT )     {         flRight[ 0 ] *= flVeloc[ 0 ];         flRight[ 1 ] *= flVeloc[ 1 ];         flRight[ 2 ] *= flVeloc[ 2 ];         set_pev( id, pev_velocity, flRight );     }         if( Buttons & IN_LEFT )     {         new Float:flLeft[ 3 ];         flLeft[ 0 ] = -flRight[ 0 ] * flVeloc[ 0 ];         flLeft[ 1 ] = -flRight[ 1 ] * flVeloc[ 1 ];         flLeft[ 2 ] = -flRight[ 2 ] * flVeloc[ 2 ];         set_pev( id, pev_velocity, flLeft );     }         if( Buttons & IN_BACK )     {         new Float:flBack[ 3 ];         flBack[ 0 ] = -flForward[ 0 ] * flVeloc[ 0 ];         flBack[ 1 ] = -flForward[ 1 ] * flVeloc[ 1 ];         flBack[ 2 ] = -flForward[ 2 ] * flVeloc[ 2 ];         set_pev( id, pev_velocity, flBack );     }         return FMRES_IGNORED; }
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
cs1.7
Senior Member
Join Date: Oct 2008
Old 01-01-2009 , 12:57   Re: I want to get velocity by viewangle
Reply With Quote #10

i could not figure out how to make it work. what do i have to edit in the code?
cs1.7 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 09:09.


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