mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
fix: issues with key item
This commit is contained in:
@@ -156,6 +156,7 @@ end
|
|||||||
|
|
||||||
function NDCore.spawnOwnedVehicle(source, vehicleID, coords, heading)
|
function NDCore.spawnOwnedVehicle(source, vehicleID, coords, heading)
|
||||||
local player = NDCore.getPlayer(source)
|
local player = NDCore.getPlayer(source)
|
||||||
|
if not player then return end
|
||||||
local vehicles = getVehicles(player.id)
|
local vehicles = getVehicles(player.id)
|
||||||
for _, vehicle in pairs(vehicles) do
|
for _, vehicle in pairs(vehicles) do
|
||||||
if vehicle.id == vehicleID and vehicle.owner == player.id then
|
if vehicle.id == vehicleID and vehicle.owner == player.id then
|
||||||
@@ -178,13 +179,15 @@ function NDCore.spawnOwnedVehicle(source, vehicleID, coords, heading)
|
|||||||
state.props = vehicle.properties
|
state.props = vehicle.properties
|
||||||
state.locked = true
|
state.locked = true
|
||||||
|
|
||||||
if Config.useInventoryForKeys then
|
if GetResourceState("ox_inventory") == "started" and Config.useInventoryForKeys then
|
||||||
exports.ox_inventory:AddItem(source, "keys", 1, {
|
if exports.ox_inventory:GetItem(source, "keys", {vehId = vehicle.id}, true) == 0 then
|
||||||
vehOwner = vehicle.owner,
|
exports.ox_inventory:AddItem(source, "keys", 1, {
|
||||||
vehId = vehicle.id,
|
vehOwner = vehicle.owner,
|
||||||
vehPlate = vehicle.properties and vehicle.properties.plate,
|
vehId = vehicle.id,
|
||||||
vehModel = vehicle.properties and vehicle.properties.model
|
vehPlate = vehicle.properties and vehicle.properties.plate,
|
||||||
})
|
vehModel = vehicle.properties and lib.callback.await("ND_Vehicles:getVehicleModelMakeLabel", source, vehicle.properties.model) or ""
|
||||||
|
})
|
||||||
|
end
|
||||||
else
|
else
|
||||||
state.keys = {
|
state.keys = {
|
||||||
[player.id] = true
|
[player.id] = true
|
||||||
@@ -303,6 +306,7 @@ if Config.useInventoryForKeys then
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterCommand("getkeys", function(source, args, rawCommand)
|
RegisterCommand("getkeys", function(source, args, rawCommand)
|
||||||
|
if GetResourceState("ox_inventory") ~= "started" then return end
|
||||||
local veh = GetVehiclePedIsIn(GetPlayerPed(source))
|
local veh = GetVehiclePedIsIn(GetPlayerPed(source))
|
||||||
if not veh or veh == 0 then return end
|
if not veh or veh == 0 then return end
|
||||||
|
|
||||||
@@ -316,7 +320,7 @@ if Config.useInventoryForKeys then
|
|||||||
vehOwner = owner,
|
vehOwner = owner,
|
||||||
vehId = state.id,
|
vehId = state.id,
|
||||||
vehPlate = props.plate,
|
vehPlate = props.plate,
|
||||||
vehModel = props.model
|
vehModel = lib.callback.await("ND_Vehicles:getVehicleModelMakeLabel", source, props.model)
|
||||||
})
|
})
|
||||||
end, false)
|
end, false)
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user