mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 14:26:03 +01:00
fix(client/vehicle): check engine hotwire with param
This commit is contained in:
@@ -286,7 +286,7 @@ local function playKeyFob(veh)
|
|||||||
local coords = GetEntityCoords(ped)
|
local coords = GetEntityCoords(ped)
|
||||||
if #(coords-GetEntityCoords(veh)) > 25.0 then return end
|
if #(coords-GetEntityCoords(veh)) > 25.0 then return end
|
||||||
|
|
||||||
if GetVehiclePedIsIn(ped) == 0 then
|
if not playerVehicle then
|
||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
lib.requestAnimDict("anim@mp_player_intmenu@key_fob@")
|
lib.requestAnimDict("anim@mp_player_intmenu@key_fob@")
|
||||||
TaskPlayAnim(ped, "anim@mp_player_intmenu@key_fob@", "fob_click_fp", 8.0, 8.0, -1, 48, 1, false, false, false)
|
TaskPlayAnim(ped, "anim@mp_player_intmenu@key_fob@", "fob_click_fp", 8.0, 8.0, -1, 48, 1, false, false, false)
|
||||||
@@ -364,7 +364,7 @@ lib.callback.register("ND_Vehicles:getVehicleModelMakeLabel", function(model)
|
|||||||
return ("%s %s"):format(make, name)
|
return ("%s %s"):format(make, name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function hasVehicleKeys(veh)
|
local function hasVehicleKeys(veh, checkEngine)
|
||||||
local state = Entity(veh).state
|
local state = Entity(veh).state
|
||||||
if Config.ox_inventory and Config.useInventoryForKeys then
|
if Config.ox_inventory and Config.useInventoryForKeys then
|
||||||
local metadata = {
|
local metadata = {
|
||||||
@@ -372,13 +372,13 @@ local function hasVehicleKeys(veh)
|
|||||||
keyEnabled = true
|
keyEnabled = true
|
||||||
}
|
}
|
||||||
local hasKey = exports.ox_inventory:GetItemCount("keys", metadata) > 0
|
local hasKey = exports.ox_inventory:GetItemCount("keys", metadata) > 0
|
||||||
return hasKey or state.hotwired
|
return hasKey or checkEngine and state.hotwired
|
||||||
end
|
end
|
||||||
|
|
||||||
local keys = state and state.keys
|
local keys = state and state.keys
|
||||||
local player = NDCore.getPlayer()
|
local player = NDCore.getPlayer()
|
||||||
local hasKey = player and keys and keys[player.id]
|
local hasKey = player and keys and keys[player.id]
|
||||||
return hasKey or state.hotwired
|
return hasKey or checkEngine and state.hotwired
|
||||||
end
|
end
|
||||||
|
|
||||||
local function hasVehicleKeysCheck(veh)
|
local function hasVehicleKeysCheck(veh)
|
||||||
@@ -387,7 +387,7 @@ local function hasVehicleKeysCheck(veh)
|
|||||||
return keyCheckTime.hasKey
|
return keyCheckTime.hasKey
|
||||||
end
|
end
|
||||||
|
|
||||||
local hasKey = hasVehicleKeys(veh)
|
local hasKey = hasVehicleKeys(veh, true)
|
||||||
keyCheckTime.lastCheck = time
|
keyCheckTime.lastCheck = time
|
||||||
keyCheckTime.hasKey = hasKey
|
keyCheckTime.hasKey = hasKey
|
||||||
return hasKey
|
return hasKey
|
||||||
@@ -614,10 +614,10 @@ exports("keyControl", function(action, slot)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
exports.ox_inventory:closeInventory()
|
||||||
if action == "trunk" then
|
if action == "trunk" then
|
||||||
local veh = getNearestVehicle(hasKeysForOnly)
|
local veh = getNearestVehicle(true)
|
||||||
if not veh then return end
|
if not veh then return end
|
||||||
exports.ox_inventory:closeInventory()
|
|
||||||
playKeyFob(veh)
|
playKeyFob(veh)
|
||||||
if GetVehicleDoorAngleRatio(veh, 5) > 0.0 then
|
if GetVehicleDoorAngleRatio(veh, 5) > 0.0 then
|
||||||
SetVehicleDoorShut(veh, 5)
|
SetVehicleDoorShut(veh, 5)
|
||||||
@@ -626,7 +626,6 @@ exports("keyControl", function(action, slot)
|
|||||||
end
|
end
|
||||||
elseif action == "disable" then
|
elseif action == "disable" then
|
||||||
TriggerServerEvent("ND_Vehicles:disableKey", slot)
|
TriggerServerEvent("ND_Vehicles:disableKey", slot)
|
||||||
exports.ox_inventory:closeInventory()
|
|
||||||
lib.notify({
|
lib.notify({
|
||||||
title = "Key disabled",
|
title = "Key disabled",
|
||||||
description = "This vehicle key has been disabled and cannot be used anymore.",
|
description = "This vehicle key has been disabled and cannot be used anymore.",
|
||||||
|
|||||||
Reference in New Issue
Block a user