Raised This Month: $ Target: $400
 0% 

How to give a player a velocity to left / right


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-05-2010 , 01:47   Re: How to give a player a velocity to left / right
Reply With Quote #4

Not tested, basically same code as velocity_by_aim

PHP Code:
enum {
    
Move_Left,
    
Move_Right,
}

SideMove(idFloat:fSpeedFloat:vRetValue[3], iDirection)
{
    new 
Float:fVecAngles[3], Float:fVecVright[3], Float:fVecVelocity[3]
    
pev(idpev_anglesfVecAngles)
    
engfunc(EngFunc_MakeVectorsfVecAngles)
    
global_get(glb_v_rightfVecVright)
    
pev(idpev_velocityfVecVelocity)

    if( 
iDirection == Move_Left )
    {
        
fVecAngles[0] = -fVecAngles[0]
        
fVecAngles[1] = -fVecAngles[1]
    }

    
fVecVelocity[0] = fVecAngles[0] * fSpeed
    fVecVelocity
[1] = fVecAngles[1] * fSpeed
    fVecVelocity
[2] = fSpeed

    set_pev
(idpev_velocityfVecVelocity)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 08:44.


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