mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
fix(client/vehicle): vehicle keys issues
This commit is contained in:
@@ -10,8 +10,9 @@ Config = {
|
||||
discordActionLink = GetConvar("discordActionLink", "https://discord.gg/Z9Mxu72zZ6"),
|
||||
discordActionText2 = GetConvar("core:discordActionText2", "STORE"),
|
||||
discordActionLink2 = GetConvar("core:discordActionLink2", "https://andyyy.tebex.io/category/fivem-scripts"),
|
||||
randomUnlockedVehicleChance = GetConvarInt("core:randomUnlockedVehicleChance", 30),
|
||||
disableVehicleAirControl = GetConvarInt("core:disableVehicleAirControl", 1) == 1,
|
||||
randomUnlockedVehicleChance = GetConvarInt("core:randomUnlockedVehicleChance", 30),
|
||||
requireKeys = GetConvarInt("core:requireKeys", 1) == 1,
|
||||
useInventoryForKeys = GetConvarInt("core:useInventoryForKeys", 1) == 1,
|
||||
groups = json.decode(GetConvar("core:groups", "[]")),
|
||||
compatibility = json.decode(GetConvar("core:compatibility", "[]"))
|
||||
|
||||
@@ -480,22 +480,35 @@ CreateThread(function()
|
||||
local wait = 500
|
||||
while true do
|
||||
Wait(wait)
|
||||
|
||||
local reset = true
|
||||
playerVehicle = cache.seat == -1 and cache.vehicle
|
||||
if playerVehicle then
|
||||
if Config.disableVehicleAirControl and not vehicleClassNotDisableAirControl[GetVehicleClass(playerVehicle)] and (IsEntityInAir(playerVehicle) or IsEntityUpsidedown(playerVehicle)) then
|
||||
wait = 0
|
||||
DisableControlAction(0, 59) -- disable vehicle air control.
|
||||
DisableControlAction(0, 60)
|
||||
elseif not GetIsVehicleEngineRunning(playerVehicle) and not hasVehicleKeysCheck(playerVehicle) then
|
||||
wait = 0
|
||||
DisableControlAction(0, 59)
|
||||
if DoesEntityExist(playerVehicle) and IsVehicleEngineStarting(playerVehicle) then
|
||||
SetVehicleEngineOn(playerVehicle, false, true, true) -- don't turn on engine if no keys.
|
||||
end
|
||||
else
|
||||
wait = 500
|
||||
|
||||
local entering = GetVehiclePedIsEntering(cache.ped)
|
||||
if entering and DoesEntityExist(entering) and IsVehicleNeedsToBeHotwired(entering) then
|
||||
SetVehicleNeedsToBeHotwired(entering, false)
|
||||
end
|
||||
|
||||
if not playerVehicle then goto skip end
|
||||
|
||||
if Config.disableVehicleAirControl and not vehicleClassNotDisableAirControl[GetVehicleClass(playerVehicle)] and (IsEntityInAir(playerVehicle) or IsEntityUpsidedown(playerVehicle)) then
|
||||
wait = 0
|
||||
reset = false
|
||||
DisableControlAction(0, 59) -- disable vehicle air control.
|
||||
DisableControlAction(0, 60)
|
||||
end
|
||||
if Config.requireKeys and not GetIsVehicleEngineRunning(playerVehicle) and not hasVehicleKeysCheck(playerVehicle) then
|
||||
wait = 0
|
||||
reset = false
|
||||
DisableControlAction(0, 59)
|
||||
DisableControlAction(0, 71)
|
||||
if DoesEntityExist(playerVehicle) and IsVehicleEngineStarting(playerVehicle) then
|
||||
SetVehicleEngineOn(playerVehicle, false, true, true) -- don't turn on engine if no keys.
|
||||
end
|
||||
elseif wait ~= 500 then
|
||||
end
|
||||
|
||||
::skip::
|
||||
if (reset or not playerVehicle) and wait ~= 500 then
|
||||
wait = 500
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user