Jump to content

help with car speed lock.


sel3a

Recommended Posts

Posted

Hello Guys, well i am asking too much these days ;P xD sry for that, anyway i am just addicted to scripting so.. Anyway listen I want to make a script, when i enter to a car it become fast, Any car. I don't want to make it car by car. I just want that when i enter to a car, it become fast, and i want it to be locked to ACL.

2-- I want a car that never gets destroyed, I mean it can't be damaged, (God Mod For Cars).

3--I want to set for a car a Nitro, I mean when i enter the car, and press CTRLor ALT, Nitro starts, and never stop.

i will show an example but it's only for one car :3

Thanks everyone, hope that u answer me, Thanks again(heart).

-- Bullet -- (299km/h) 
function handlingChange7 (theVehicle7, seat ) 
    if getElementModel(theVehicle7) == 541 and seat == 0 then 
local account = getPlayerAccount(source) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "DoNotTouchThis" ) ) ) then 
        setVehicleHandling(theVehicle7, "maxVelocity", 285) 
        setVehicleHandling(theVehicle7, "engineAcceleration", 20) 
        setVehicleHandling(theVehicle7, "driveType", "awd") 
         setVehicleHandling(theVehicle7, "handlingFlags", 0x1008000) 
    end  
end 
end 
  
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), handlingChange7 ) 
  
  

  • Moderators
Posted

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

i don't need this i need someting like this

function applyHandling() --Applies handling to all cars 
    local vehicleIDs = getAllVehicleIDs() 
    for _,vehicleID in pairs(vehicleIDs) do 
        doNotExecute = false 
        --Listed ID's do not get the handling: 
        local vorbiddenVehicles = { 581, 509, 481, 462, 521, 463, 510, 522, 461, 448, 468, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 } 
        for _,v in pairs(vorbiddenVehicles) do 
            if v == vehicleID then 
                doNotExecute = true 
                break 
            end 
        end 
        if doNotExecute ~= true then 
            local handlingTable = getOriginalHandling(vehicleID) 
            --The stuff below here is setting the model-handling, you can tweak it however you want :3 
             
            --Engine 
            setModelHandling (vehicleID, "engineAcceleration", handlingTable["maxVelocity"]*1.4) 
            setModelHandling (vehicleID, "engineInertia", 90) 
             
            --Suspension 
            setModelHandling (vehicleID, "suspensionHighSpeedDamping", 0) 
            setModelHandling (vehicleID, "suspensionForceLevel", handlingTable["suspensionForceLevel"]*0.9) 
            setModelHandling (vehicleID, "suspensionLowerLimit", handlingTable["suspensionLowerLimit"]*1.-- s8) -->
            setModelHandling (vehicleID, "suspensionDamping", handlingTable["suspensionDamping"]*1.-- s8) -->
            setModelHandling (vehicleID, "turnMass", handlingTable["turnMass"]*1.05) 
             
            --Brakes 
            setModelHandling (vehicleID, "brakeDeceleration", 3) 
        end 
    end 
    for _,vehicle in ipairs(getElementsByType("vehicle")) do 
        setVehicleHandling(vehicle,false) 
    end 
end 
addEventHandler("onResourceStart",getRootElement(getThisResource()),applyHandling) 
  
function resetHandling() --Resets handling for all cars 
    local vehicleIDs = getAllVehicleIDs() 
    for _,vehicleID in pairs(vehicleIDs) do 
        for k,_ in pairs(getModelHandling(vehicleID)) do 
            setModelHandling(vehicleID, k, nil) 
        end 
    end 
    for _,vehicle in ipairs(getElementsByType("vehicle")) do 
        setVehicleHandling (vehicle,true) 
    end 
end 
addEventHandler("onResourceStop",getRootElement(getThisResource()),resetHandling) 
  
function getAllVehicleIDs() --Gets all vehicle-IDs 
    local vehicleIDs = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
    405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 
    417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431,  
    438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524,  
    423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534,  
    567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500,  
    444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458,  
    606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } 
    return vehicleIDs 
end 

but locked to the ACL and with this scrpit

1-- I want a car that never gets destroyed, I mean it can't be damaged, (God Mod For Cars).

1--I want to set for a car a Nitro, I mean when i enter the car, and press CTRLor ALT, Nitro starts, and never stop.

  • Moderators
Posted

I just gave you that and you are too lazy to check it out.

this is the scripting section, not the request section.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

lol dude you gave me a nitro section and damage one i need the car to be locked to the ACL for all the cars

i hope that you got it

  • Moderators
Posted

Car speed can be locked by adjust:

https://wiki.multitheftauto.com/wiki/SetControlState

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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