Jump to content

get all handlings from a car


DjSt3rios

Recommended Posts

Hello guys. I wanna make a command to get all the handlings of the car, the acceleration, mass etc.

I tried to use this function, but still It's not working:

function carhandlings(thePlayer, command) 
    local handlings = getVehicleHandling(getPedOccupiedVehicle(thePlayer)) 
    for i,v in ipairs(handlings) do outputChatBox(i,v) end 
end 
addCommandHandler("handlings", carhandlings) 

I don't get any errors, I just don't see any message. Any help?

Link to comment

You cannot output i,v as you can with print().

Also, handling properties are strings, so you cannot iterate them with ipairs(). Use ipairs for dictionared tables.

function carhandlings(thePlayer, command) 
    local handlings = getVehicleHandling(getPedOccupiedVehicle(thePlayer)) 
    for property,value in pairs(handlings) do 
        outputChatBox( property.." = "..tostring(value) ) 
    end 
end 
addCommandHandler("handlings", carhandlings) 

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