This is supposed to check if the player has a permission and then make the car speed the bypass speed in the config but it just puts it at the normal speed even if I have the permission.
I get no errors or anything but it just doesn’t seem to work.
this is the only part that doesn’t work as intended the rest of the script works fine
Citizen.CreateThread( function()
while true do
Citizen.Wait( 100 )
while not IsPedInAnyVehicle(PlayerPedId(), false)
do
Citizen.Wait(5000)
end
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if vehicle ~= nil then
if IsAceAllowed("speedbypass") then
setSpeed(Config.bypassSpeed,vehicle)
else
setSpeed(Config.maxSpeed,vehicle)
end
end
end
end)
Sorry my bad I just realised if id didnt include the whole thing it wouldnt make sense as setSpeed is a function
Citizen.CreateThread( function()
while true do
Citizen.Wait( 100 )
while not IsPedInAnyVehicle(PlayerPedId(), false)
do
Citizen.Wait(5000)
end
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if vehicle ~= nil then
if IsAceAllowed("speedbypass") then
SetSpeed(vehicle,Config.bypassSpeed)
else
setSpeed(vehicle,Config.maxSpeed)
end
end
end
end)
function setSpeed(vehicle,speed)
local vehicleDefaultSpeed = GetVehicleEstimatedMaxSpeed(vehicle)
local vehicleClass = GetVehicleClass(vehicle)
if Config.kmh then
speed = speed / 3.6
else
speed = speed / 2.23694
end
if (vehicleClass ~= 16) or (vehicleClass ~= 15) then
if vehicleDefaultSpeed > speed then
SetVehicleMaxSpeed(vehicle, speed)
end
end
end