xpan15 Posted October 3, 2022 Share Posted October 3, 2022 Hi all. Just download a handling script to predefine the handling for cars. for meta.xml : <meta> <info author="Dutchman101" type="script" version="1.1.0" /> <script src="handlingpresets.lua" type="server" /> </meta> for handlingpresets.lua : -- For handling flags and value range refer to https://wiki.multitheftauto.com/wiki/SetModelHandling -- Add any handling value type not included below, by simply adding its string in below format followed by = value as below. Get valid strings from https://wiki.multitheftauto.com/wiki/SetModelHandling local predefinedHandling = { [411] = { ["engineAcceleration"] = 14, ["dragCoeff"] = 0, ["maxVelocity"] = 100000, ["tractionMultiplier"] = 0.9, ["tractionLoss"] = 1.1, }, [415] = { ["engineAcceleration"] = 14, ["dragCoeff"] = 0, ["maxVelocity"] = 100000, ["tractionMultiplier"] = 0.9, ["tractionLoss"] = 1.1, }, [562] = { -- Universal, good drift handling; set to Elegy by default. ["driveType"] = "rwd", ["engineAcceleration"] = 200, ["dragCoeff"] = 1.5, ["maxVelocity"] = 300, ["tractionMultiplier"] = 0.7, ["tractionLoss"] = 0.8, ["collisionDamageMultiplier"] = 0.4, ["engineInertia"] = -175, ["steeringLock"] = 75, ["numberOfGears"] = 4, ["suspensionForceLevel"] = 0.8, ["suspensionDamping"] = 0.8, ["suspensionUpperLimit"] = 0.33, ["suspensionFrontRearBias"] = 0.3, ["mass"] = 1800, ["turnMass"] = 3000, ["centerOfMass"] = { [1]=0, [2]=-0.2, [3]=-0.5 }, -- Good example to understand centerOfMass parameter usage }, --next model below etc (copy rows) } for i,v in pairs (predefinedHandling) do if i then for handling, value in pairs (v) do if not setModelHandling (i, handling, value) then outputDebugString ("* Predefined handling '"..tostring(handling).."' for vehicle model '"..tostring(i).."' could not be set to '"..tostring(value).."'") end end end end for _,v in ipairs (getElementsByType("vehicle")) do if v and predefinedHandling[getElementModel(v)] then for k,vl in pairs (predefinedHandling[getElementModel(v)]) do setVehicleHandling (v, k, vl) end end end function resetHandling() for model in pairs (predefinedHandling) do if model then for k in pairs(getOriginalHandling(model)) do setModelHandling(model, k, nil) end end end for _,v in ipairs (getElementsByType("vehicle")) do if v then local model = getElementModel(v) if predefinedHandling[model] then for k,h in pairs(getOriginalHandling(model)) do setVehicleHandling(v, k, h) end end end end end addEventHandler("onResourceStop", resourceRoot, resetHandling) They work with the normal vehicle IDs ( 400 -611 ) . However, I have downloaded the add-new-models things. https://github.com/Fernando-A-Rocha/mta-add-models I want to insert the customIDs like 80001 into the handling scripts. Is that possible ? Thank you. One thing very exciting is that it is possible to get the custom IDs indirectly. I combined the buycarsmod and add-new-models together. CustomIDs are saved in cars.xml for buycarsmod : <car> <cars> <vehicle x="-2838.6552734375" y="536.693359375" z="5.2363595962524" a="157.08215332031" color1="62" color2="1" owner="PTY-RyanPan[BGAT-MP]" price="0" lock="0" model="80036"></vehicle> </cars> </car> You can use it to get the Custom IDs, but the buycarsmod has no export functions. local carmodel = xmlNodeGetAttribute (v,"model") 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