Jump to content

Handling problem


KITT1995

Recommended Posts

I have a problem with this code

function resourceStarted() 
    local handling = createHandling()                                -- create a new handling element 
    addDefaultHandling(getVehicleModelFromName("infernus"), handling)   -- attach it to the Infernus ID 
    handlingSetEngineAcceleration(handling, 50)                      -- change its acceleration property (thereby changing the acceleration of all Infernus cars) 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStarted) 

When i start the script i get an error in the server log "ERROR: replace\script3.lua:2: attempt to call global 'createHandling' (a nil value)".

How I can fix this?

Link to comment
So, your trying to create a Handler for all Vehicles that are Infernus?

Yes

  
for i,v in ipairs(getElementsByType("vehicle")) do 
     if getElementModel(v) == INFERNUSMODELNUMBERHERE then 
          setVehicleHandling(v, handlingType, value) 
     end 
end 
  

Where i need to write the handling values?

1.1 only.

I have 1.1

Link to comment
  
handlingType = "acceleration" 
value = 99^99*99^99*99^99*99^99 
doForall = false -- iF you wanna do it for all 
MODELNUMBERHERE = 411 -- infernus 
  
for i,v in ipairs(getElementsByType("vehicle")) do 
     if doForall then 
                     setVehicleHandling(v, handlingType, value) 
                      break 
      end 
     if getElementModel(v) == MODELNUMBERHERE then 
          setVehicleHandling(v, handlingType, value) 
     end 
end 
  

Link to comment
  
handlingType = "acceleration" 
value = 99^99*99^99*99^99*99^99 
doForall = false -- iF you wanna do it for all 
MODELNUMBERHERE = 411 -- infernus 
  
for i,v in ipairs(getElementsByType("vehicle")) do 
     if doForall then 
                     setVehicleHandling(v, handlingType, value) 
                      break 
      end 
     if getElementModel(v) == MODELNUMBERHERE then 
          setVehicleHandling(v, handlingType, value) 
     end 
end 
  

It doesn't work, I get this error "WARNING: replace\script3.lua:8: Bad 'property' pointer @ 'setVehicleHandling'(2)

Link to comment
  
handlingType = "maxVelocity" 
value = 99^99*99^99*99^99*99^99 
doForall = false -- iF you wanna do it for all 
MODELNUMBERHERE = 411 -- infernus 
  
for i,v in ipairs(getElementsByType("vehicle")) do 
     if doForall then 
                     setVehicleHandling(v, handlingType, value) 
                      break 
      end 
     if getElementModel(v) == MODELNUMBERHERE then 
          setVehicleHandling(v, handlingType, value) 
     end 
end 
  

Lazy.

Link to comment
  
handlingType = "maxVelocity" 
value = 99^99*99^99*99^99*99^99 
doForall = false -- iF you wanna do it for all 
MODELNUMBERHERE = 411 -- infernus 
  
for i,v in ipairs(getElementsByType("vehicle")) do 
     if doForall then 
                     setVehicleHandling(v, handlingType, value) 
                      break 
      end 
     if getElementModel(v) == MODELNUMBERHERE then 
          setVehicleHandling(v, handlingType, value) 
     end 
end 
  

Lazy.

Same error

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