Jump to content

Help Handling.lua


Poloman

Recommended Posts

Posted

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
Posted

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 

  Tutorials  4x 

 

Posted
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

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

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:

:lol::P I started to laugh at this part of golanu21:

local hp = getElementHealth(source) 
if hp == 0 then 
return end 

Sometimes I dream about cheese

  • Moderators
Posted
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 

  Tutorials  4x 

 

Posted
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!

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