Jump to content

setElementVelocity?


igthomas

Recommended Posts

setElementVelocity set's a element velocity.

Example from wiki:

speedx, speedy, speedz = getElementVelocity ( getPlayerFromName ( "someguy" ) ) -- get the velocity of the player named "someguy" 
setElementVelocity ( getPlayerFromName ( "Ted" ), speedx, speedy, speedz )      -- copy the velocity to a player named "Ted" 

You can't just use one simple argument, it doesn't work like game speed.

Link to comment

It's not create any effect ..

Explain:you set all arguments to 0 0 0 you stopped and again you create 0 0 0. You made the same..

I understand he need create fast move.( 2x faster )

  
-- uElement is your element.( player ) 
function fGetPointFromDistanceRotation( fX, fY, nDist, nAngle ) 
    local nA = math.rad( 90 - nAngle ) 
  
    local nDx = math.cos( nA ) * nDist 
    local nDy = math.sin( nA ) * nDist 
  
    return fX + nDx, fY + nDy 
end 
  
local fX, fY, fZ, fLx, fLy, fLz = getCameraMatrix( ) 
local fNewX, fNewY = fGetPointFromDistanceRotation( fX, fY, 10, getPedRotation( uElement ) ) 
setElementVelocity( uElement, fNewX, fNewY, fZ ) 
  

Just example

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...