KalashnikovZ Posted January 8, 2016 Posted January 8, 2016 I wanted to make some realistic handling for an APC, but the script isn't working, any suggestions? function btr90 ( ) for _,v in pairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling (v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end addEventHandler( "onClientResourceStart", getResourceRootElement( ), btr90 ) Thanks //Kala
luskanek Posted January 8, 2016 Posted January 8, 2016 function btr90 ( ) for _,v in pairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling (v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end addEventHandler( "onResourceStart", getResourceRootElement( ), btr90 ) setVehicleHandling() is a server-only function
KalashnikovZ Posted January 8, 2016 Author Posted January 8, 2016 I put it as a server file, but still nothing
luskanek Posted January 8, 2016 Posted January 8, 2016 addEventHandler("onResourceStart", getRootElement(), function() for _, v in ipairs(getElementsByType("vehicle")) do if getElementModel(v) == 601 then setVehicleHandling(v, "mass", 15000.0) setVehicleHandling(v, "turnMass", 15000) setVehicleHandling(v, "maxVelocity", 70.0) setVehicleHandling(v, "engineAcceleration", 5.0 ) setVehicleHandling(v, "engineInertia", 25.0) setVehicleHandling(v, "steeringLock", 25.0 ) setVehicleHandling(v, "seatOffsetDistance", 1.0) end end end )
KalashnikovZ Posted January 8, 2016 Author Posted January 8, 2016 Sorry, but what does "ipairs" mean? And still nothing
luskanek Posted January 8, 2016 Posted January 8, 2016 (edited) addEventHandler("onResourceStart", getRootElement(), function() setModelHandling(601, "mass", 15000.0) setModelHandling(601, "turnMass", 15000) setModelHandling(601, "maxVelocity", 70.0) setModelHandling(601, "engineAcceleration", 5.0 ) setModelHandling(601, "engineInertia", 25.0) setModelHandling(601, "steeringLock", 25.0 ) setModelHandling(601, "seatOffsetDistance", 1.0) end ) Use this instead, it's alot better. Edited January 9, 2016 by Guest
1LoL1 Posted January 9, 2016 Posted January 9, 2016 addEventHandler("onResourceStart", getRootElement(), function() setModelHandling(v, "mass", 15000.0) setModelHandling(v, "turnMass", 15000) setModelHandling(v, "maxVelocity", 70.0) setModelHandling(v, "engineAcceleration", 5.0 ) setModelHandling(v, "engineInertia", 25.0) setModelHandling(v, "steeringLock", 25.0 ) setModelHandling(v, "seatOffsetDistance", 1.0) end ) Use this instead, it's alot better. Where is "v" defined?
luskanek Posted January 9, 2016 Posted January 9, 2016 Whoops, was in a hurry and forgot about that one, fixed. Thanks for pointing it out!
aka Blue Posted January 9, 2016 Posted January 9, 2016 Try this. I was made it for Sweepers but should work for other vehicles: for _, vehiculo in ipairs ( getElementsByType ( 'vehicle' ) ) do if getElementModel ( vehiculo ) == 574 then setVehicleHandling(vehiculo, "maxVelocity", 120.0) setVehicleHandling(vehiculo, "engineAcceleration", 10.0 ) end end
KalashnikovZ Posted January 9, 2016 Author Posted January 9, 2016 It worked, I didn't define what 'v' is
KalashnikovZ Posted January 13, 2016 Author Posted January 13, 2016 Yeah, and I also used the setModelHandling, it's better, yes. Thanks!
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