Poloman Posted August 1, 2013 Posted August 1, 2013 Hello i have a problem in the gamemode race with the script handling.lua, when the map starts the script works perfectly but when i press enter or die (respawn), the script doesn't works anymore... So i was wondering if there's any solution,i guess yes... but i'm not a professional scripter, here's the script... thanks function handlingChange() setModelHandling(423, "mass", 10000.0) setModelHandling(423, "turnMass", 50000.0) setModelHandling(423, "dragCoeff", 2.0) setModelHandling(423, "centerOfMass", { 0.0, 0.0, -0.6 } ) setModelHandling(423, "percentSubmerged", 80) setModelHandling(423, "tractionMultiplier", 0.70) setModelHandling(423, "tractionLoss", 0.9) setModelHandling(423, "tractionBias", 0.5) setModelHandling(423, "numberOfGears", 5) setModelHandling(423, "maxVelocity", 154.0) setModelHandling(423, "engineAcceleration", 35.0) setModelHandling(423, "engineInertia", 10.0) setModelHandling(423, "driveType", "awd") setModelHandling(423, "engineType", "petrol") setModelHandling(423, "brakeDeceleration", 11.0) setModelHandling(423, "brakeBias", 0.45) setModelHandling(423, "ABS", false) setModelHandling(423, "steeringLock", 30.0) setModelHandling(423, "suspensionForceLevel", 1.4) setModelHandling(423, "suspensionDamping", 0.10) setModelHandling(423, "suspensionHighSpeedDamping", 0.0) setModelHandling(423, "suspensionUpperLimit", 0.40) setModelHandling(423, "suspensionLowerLimit", -0.40) setModelHandling(423, "suspensionFrontRearBias", 0.5) setModelHandling(423, "suspensionAntiDiveMultiplier", 0.3) setModelHandling(423, "seatOffsetDistance", 0.20) setModelHandling(423, "collisionDamageMultiplier", 0.20) setModelHandling(423, "monetary", 35000) setModelHandling(423, "modelFlags", 0x40006800) setModelHandling(423, "handlingFlags", 0x1300005) setModelHandling(423, "headLight", 9) setModelHandling(423, "tailLight", 1) setModelHandling(423, "animGroup", 0) end addEventHandler("onResourceStart", resourceRoot, handlingChange)
Moderators IIYAMA Posted August 1, 2013 Moderators Posted August 1, 2013 It must work unless it got overwritten. Note: After you set the vehicle handling only new vehicles will have this, not the old ones. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Moderators IIYAMA Posted August 7, 2013 Moderators Posted August 7, 2013 What error? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
golanu21 Posted August 7, 2013 Posted August 7, 2013 function handlingChange() setModelHandling(423, "mass", 10000.0) setModelHandling(423, "turnMass", 50000.0) setModelHandling(423, "dragCoeff", 2.0) setModelHandling(423, "centerOfMass", { 0.0, 0.0, -0.6 } ) setModelHandling(423, "percentSubmerged", 80) setModelHandling(423, "tractionMultiplier", 0.70) setModelHandling(423, "tractionLoss", 0.9) setModelHandling(423, "tractionBias", 0.5) setModelHandling(423, "numberOfGears", 5) setModelHandling(423, "maxVelocity", 154.0) setModelHandling(423, "engineAcceleration", 35.0) setModelHandling(423, "engineInertia", 10.0) setModelHandling(423, "driveType", "awd") setModelHandling(423, "engineType", "petrol") setModelHandling(423, "brakeDeceleration", 11.0) setModelHandling(423, "brakeBias", 0.45) setModelHandling(423, "ABS", false) setModelHandling(423, "steeringLock", 30.0) setModelHandling(423, "suspensionForceLevel", 1.4) setModelHandling(423, "suspensionDamping", 0.10) setModelHandling(423, "suspensionHighSpeedDamping", 0.0) setModelHandling(423, "suspensionUpperLimit", 0.40) setModelHandling(423, "suspensionLowerLimit", -0.40) setModelHandling(423, "suspensionFrontRearBias", 0.5) setModelHandling(423, "suspensionAntiDiveMultiplier", 0.3) setModelHandling(423, "seatOffsetDistance", 0.20) setModelHandling(423, "collisionDamageMultiplier", 0.20) setModelHandling(423, "monetary", 35000) setModelHandling(423, "modelFlags", 0x40006800) setModelHandling(423, "handlingFlags", 0x1300005) setModelHandling(423, "headLight", 9) setModelHandling(423, "tailLight", 1) setModelHandling(423, "animGroup", 0) local hp = getElementHealth(source) if hp == 0 then return end end addEventHandler("onResourceStart", resourceRoot, handlingChange) NOT TESTED [Dev]BloWnRPG - We BloW the World [1%]
Moderators IIYAMA Posted August 7, 2013 Moderators Posted August 7, 2013 wtf? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
denny199 Posted August 7, 2013 Posted August 7, 2013 on-topic: Add this to your script, it will replace the handling everytime when a player enters a vehicle. addEventHandler ("onVehicleEnter", root, function () handlingChange() end) off-topic: I started to laugh at this part of golanu21: local hp = getElementHealth(source) if hp == 0 then return end Sometimes I dream about cheese
golanu21 Posted August 7, 2013 Posted August 7, 2013 because i make guys to laugh [Dev]BloWnRPG - We BloW the World [1%]
Poloman Posted August 10, 2013 Author Posted August 10, 2013 Nothing works Please i need a solution, thanks...
xXMADEXx Posted August 10, 2013 Posted August 10, 2013 When someone enters a vehicle (onVehicleEnter) get the model, and if the model is 423 then set the vehicles handling... The Ultimate Lua Tutorial! | MTA PHP SDK
Moderators IIYAMA Posted August 10, 2013 Moderators Posted August 10, 2013 local vehicleHandling423 = { {"mass", 10000.0}, {"turnMass", 50000.0}, {"dragCoeff", 2.0}, {"centerOfMass", { 0.0, 0.0, -0.6 }}, {"percentSubmerged", 80}, { "tractionMultiplier", 0.70}, {"tractionLoss", 0.9}, {"tractionBias", 0.5}, {"numberOfGears", 5}, {"maxVelocity", 154.0}, {"engineAcceleration", 35.0}, {"engineInertia", 10.0}, {"driveType", "awd"}, {"engineType", "petrol"}, {"brakeDeceleration", 11.0}, {"brakeBias", 0.45}, { "ABS", false}, {"steeringLock", 30.0}, {"suspensionForceLevel", 1.4}, {"suspensionDamping", 0.10}, {"suspensionHighSpeedDamping", 0.0}, {"suspensionUpperLimit", 0.40}, {"suspensionLowerLimit", -0.40}, {"suspensionFrontRearBias", 0.5}, {"suspensionAntiDiveMultiplier", 0.3}, {"seatOffsetDistance", 0.20}, {"collisionDamageMultiplier", 0.20}, {"monetary", 35000}, {"modelFlags", 0x40006800}, {"handlingFlags", 0x1300005}, {"headLight", 9}, {"tailLight", 1}, {"animGroup", 0} } addEventHandler("onVehicleEnter",root, function () if getElementModel(source) == 423 then for i=1,#vehicleHandling423 do local dataHandling = vehicleHandling423[i] setVehicleHandling(source,dataHandling[1],dataHandling[2] ) end end end) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Poloman Posted August 10, 2013 Author Posted August 10, 2013 local vehicleHandling423 = { {"mass", 10000.0}, {"turnMass", 50000.0}, {"dragCoeff", 2.0}, {"centerOfMass", { 0.0, 0.0, -0.6 }}, {"percentSubmerged", 80}, { "tractionMultiplier", 0.70}, {"tractionLoss", 0.9}, {"tractionBias", 0.5}, {"numberOfGears", 5}, {"maxVelocity", 154.0}, {"engineAcceleration", 35.0}, {"engineInertia", 10.0}, {"driveType", "awd"}, {"engineType", "petrol"}, {"brakeDeceleration", 11.0}, {"brakeBias", 0.45}, { "ABS", false}, {"steeringLock", 30.0}, {"suspensionForceLevel", 1.4}, {"suspensionDamping", 0.10}, {"suspensionHighSpeedDamping", 0.0}, {"suspensionUpperLimit", 0.40}, {"suspensionLowerLimit", -0.40}, {"suspensionFrontRearBias", 0.5}, {"suspensionAntiDiveMultiplier", 0.3}, {"seatOffsetDistance", 0.20}, {"collisionDamageMultiplier", 0.20}, {"monetary", 35000}, {"modelFlags", 0x40006800}, {"handlingFlags", 0x1300005}, {"headLight", 9}, {"tailLight", 1}, {"animGroup", 0} } addEventHandler("onVehicleEnter",root, function () if getElementModel(source) == 423 then for i=1,#vehicleHandling423 do local dataHandling = vehicleHandling423[i] setVehicleHandling(source,dataHandling[1],dataHandling[2] ) end end end) thank you very much!
Moderators IIYAMA Posted August 10, 2013 Moderators Posted August 10, 2013 np. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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