Advertisement
JeViCo

Поставить хендлинг по пасте из ГТА

Mar 6th, 2020 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. local jobVehHandling = {
  2.     [456] = "YANKEE 4500 18003.699 3 0 0 0 80 0.7 0.7 0.48 5 160 10 40 r d 4.5 0.8 false 30 1.8 0.12 0 0.3 -0.1 0.4 0 0.35 0.45 22000 4088 1 0 1 0",
  3. }
  4.  
  5. local handlingNamesTable =
  6. {
  7.     "mass","turnMass","dragCoeff","centerOfMassX","centerOfMassY","centerOfMassZ","percentSubmerged","tractionMultiplier","tractionLoss", "tractionBias", "numberOfGears","maxVelocity","engineAcceleration","engineInertia",
  8.     "driveType","engineType","brakeDeceleration","brakeBias","ABS","steeringLock","suspensionForceLevel","suspensionDamping","suspensionHighSpeedDamping","suspensionUpperLimit",
  9.     "suspensionLowerLimit","suspensionFrontRearBias","suspensionAntiDiveMultiplier","seatOffsetDistance","collisionDamageMultiplier","monetary","modelFlags","handlingFlags"
  10. }
  11.  
  12. function setVehicleHandlings(veh)
  13.     if veh and isElement(veh) then
  14.         if not jobVehHandling[getElementModel(veh)] then return end
  15.         local strArray = {}
  16.         for token in string.gmatch(jobVehHandling[getElementModel(veh)], "[^%s]+") do
  17.             table.insert(strArray,token)
  18.         end
  19.         local i = 2
  20.         for k,v in pairs(handlingNamesTable) do
  21.             setVehicleHandling(veh, v, strArray[i])
  22.             if v == "modelFlags" or v == "handlingFlags" then
  23.                 setVehicleHandling(veh, v, tonumber("0x"..strArray[i]))
  24.             elseif v == "driveType" then
  25.                 if strArray[i] == "4" then
  26.                     setVehicleHandling(veh, v, "awd")
  27.                 elseif strArray[i] == "f" then
  28.                     setVehicleHandling(veh, v, "fwd")
  29.                 elseif strArray[i] == "r" then
  30.                     setVehicleHandling(veh, v, "rwd")
  31.                 end
  32.             end
  33.             i = i + 1
  34.         end
  35.     end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement