Jump to content

[HELP]Car Velocity


K4stic

Recommended Posts

i want up only to carID 596: maxVelocity,driveType,engineAcceleration,numberOfGears and it's saying

Error at line 3:

function speedup() 
    for i, vehicleiD in ipairs ( getElementsByType("vehicle") ) do 
        local Type = ( getElementType ( i ) == "vehicle" ) 
        if ( Type and getVehicleModelFromName( i ) == 596 ) then 
            local handlingTable = getVehicleHandling ( i ) 
            local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) 
            setVehicleHandling ( i, "numberOfGears", 5 ) 
            setVehicleHandling ( i, "driveType", 'awd' ) 
            setVehicleHandling ( i, "maxVelocity", newVelocity ) 
            setVehicleHandling ( i, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) 
        end 
    end 
end 
addEventHandler ( "onResourceStart", resourceRoot, speedup ) 

Link to comment
function speedup (thePlayer) 
if (getElementModel(source) == 596) then 
local handlingTable = getVehicleHandling (source) 
local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) 
setVehicleHandling ( source, "numberOfGears", 5 ) 
setVehicleHandling ( source, "driveType", 'awd' ) 
setVehicleHandling ( source, "maxVelocity", newVelocity ) 
setVehicleHandling ( source, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) 
end 
end 
addEventHandler("onVehicleEnter", root, speedup) 

Link to comment
function speedup (thePlayer) 
if (getElementModel(source) == 596) then 
local handlingTable = getVehicleHandling (source) 
local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) 
setVehicleHandling ( source, "numberOfGears", 5 ) 
setVehicleHandling ( source, "driveType", 'awd' ) 
setVehicleHandling ( source, "maxVelocity", newVelocity ) 
setVehicleHandling ( source, "engineAcceleration", handlingTable["engineAcceleration"] +8 ) 
end 
end 
addEventHandler("onVehicleEnter", root, speedup) 

1. i say Thx it's fixed

2. i was need that to them resource start to that apply all every Car with this ID not them enter a Player to car

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