KITT1995 Posted August 1, 2011 Share Posted August 1, 2011 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
ChaseOquinn Posted August 1, 2011 Share Posted August 1, 2011 That function is old and has been removed. Use this function. setVehicleHandling - https://wiki.multitheftauto.com/wiki/SetVehicleHandling Link to comment
KITT1995 Posted August 1, 2011 Author Share Posted August 1, 2011 I saw that function, but I don't know how to use it to give the handling to all cars of the same model (for example all infernus). Can someone please explain how to do this? Link to comment
Jaysds1 Posted August 1, 2011 Share Posted August 1, 2011 So, your trying to create a Handler for all Vehicles that are Infernus? Link to comment
AGENT_STEELMEAT Posted August 2, 2011 Share Posted August 2, 2011 for i,v in ipairs(getElementsByType("vehicle")) do if getElementModel(v) == INFERNUSMODELNUMBERHERE then setVehicleHandling(v, handlingType, value) end end Link to comment
KITT1995 Posted August 2, 2011 Author Share Posted August 2, 2011 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
qaisjp Posted August 2, 2011 Share Posted August 2, 2011 Create locals or globals. handlingType = "acceleration" value = 99^99*99^99*99^99*99^99 That should work. Link to comment
KITT1995 Posted August 2, 2011 Author Share Posted August 2, 2011 Create locals or globals. handlingType = "acceleration" value = 99^99*99^99*99^99*99^99 That should work. Can u please write the full script with only one handling value? Link to comment
qaisjp Posted August 2, 2011 Share Posted August 2, 2011 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
KITT1995 Posted August 2, 2011 Author Share Posted August 2, 2011 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
qaisjp Posted August 2, 2011 Share Posted August 2, 2011 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
KITT1995 Posted August 2, 2011 Author Share Posted August 2, 2011 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
qaisjp Posted August 2, 2011 Share Posted August 2, 2011 setVehicleHandling We aren't your servants, try to fix it yourself. Link to comment
KITT1995 Posted August 2, 2011 Author Share Posted August 2, 2011 setVehicleHandling We aren't your servants, try to fix it yourself. Ok thanks Link to comment
KITT1995 Posted August 3, 2011 Author Share Posted August 3, 2011 Ok then i fixed the script and now works like a sharm. For who want to know how to make a handling that works for all cars of the same model please see here https://wiki.multitheftauto.com/wiki/SetVehicleHandling. I putted an example at bottom of the page Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now