Need help with adjusting vehicle speeds


#1

Hello,

Im staerting a new server just to mess around with friends and i want to make cars to slightly faster. /

I have a bunch of cars in, so i downloaded the plugin “CarCommand” which baseicaly spawns the car i want.

Im building off this script and useing “SetVehicleEnginePowerMultiplier” to make the cars go faster, but the only problem is, the cars arent going any faster.

My code is below.

-- Shows a notification on the player's screen 
function ShowNotification( text )
    SetNotificationTextEntry("STRING")
    AddTextComponentSubstringPlayerName(text)
    DrawNotification(false, false)
end

RegisterCommand('car', function(source, args, rawCommand)
    local x,y,z = table.unpack(GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 8.0, 0.5))
    local veh = args[1]
    if veh == nil then veh = "adder" end
    vehiclehash = GetHashKey(veh)
    RequestModel(vehiclehash)
    
    Citizen.CreateThread(function() 
        local waiting = 0
        while not HasModelLoaded(vehiclehash) do
            waiting = waiting + 100
            Citizen.Wait(100)
            if waiting > 5000 then
                ShowNotification("~r~Could not load the vehicle model in time, a crash was prevented.")
                break
            end
        end
        localnewCar= CreateVehicle(vehiclehash, x, y, z, GetEntityHeading(PlayerPedId())+90, 1, 0)
        SetVehiceEnginePowerMultiplier(newCar, 2.0)
    end)
end)

Please help with any suggestions, or if you can fix it, it would be amazing! Thanks.


#2

there’s your problem. it should be local newCar = CreateVehicle


#3

ahh i see. Thank You! I appreciate it!

Much love <3


#4

What’s up.bro, I am also trying to make it where emergency cars have a slight advantage in speed, can you possibly send me the script :grinning: