Jump to content

getElementVelocity


SkatCh

Recommended Posts

guys please i need some help cn anyone tell me what's the problem here :

In this part :

function vehiclestatus ( ) 
    if ( isPedInVehicle ( localPlayer ) == false ) then return false end 
    local x, y, z = getElementPosition( localPlayer ) 
    local car = getPedOccupiedVehicle ( localPlayer ) 
    local sx, sy, sz = getElementVelocity(car) 
    local kphSpeed = math.ceil (( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) 
    local mphSpeed = math.ceil (( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) 

Error + warning :

c08733ea74.png

9eaa48ac8e.png

Link to comment

Heres your problem:

  
    local car = getPedOccupiedVehicle ( localPlayer ) 
    local sx, sy, sz = getElementVelocity(car) 

Go with this:

  
local car = getPedOccupiedVehicle ( localPlayer ) 
if car then 
local sx, sy, sz = getElementVelocity(car) 
else 
local sx,sy,sz = getElementVelocity( localPlayer ) 
end 

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...