mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-18 22:36:03 +01:00
fix(server/vehicle): taking out impounded vehicle
This commit is contained in:
@@ -411,7 +411,8 @@ function NDCore.spawnOwnedVehicle(source, vehicleId, coords, heading)
|
|||||||
if not player then return end
|
if not player then return end
|
||||||
|
|
||||||
local vehicle = NDCore.getVehicleById(vehicleId)
|
local vehicle = NDCore.getVehicleById(vehicleId)
|
||||||
if not vehicle or not vehicle.available or vehicle.owner ~= player.id then return end
|
if not vehicle or vehicle.owner ~= player.id then return end
|
||||||
|
if not vehicle.available and not vehicle.impounded then return end
|
||||||
|
|
||||||
MySQL.query.await("UPDATE nd_vehicles SET stored = ? WHERE id = ?", {0, vehicleId})
|
MySQL.query.await("UPDATE nd_vehicles SET stored = ? WHERE id = ?", {0, vehicleId})
|
||||||
|
|
||||||
@@ -701,6 +702,11 @@ RegisterNetEvent("ND_Vehicles:takeVehicle", function(vehId, locations)
|
|||||||
local vehicle = NDCore.getVehicleById(vehId)
|
local vehicle = NDCore.getVehicleById(vehId)
|
||||||
local player = NDCore.getPlayer(src)
|
local player = NDCore.getPlayer(src)
|
||||||
if not player or not vehicle or vehicle.owner ~= player.id then return end
|
if not player or not vehicle or vehicle.owner ~= player.id then return end
|
||||||
|
|
||||||
|
local info = NDCore.spawnOwnedVehicle(src, vehicle.id, isParkingAvailable(locations))
|
||||||
|
if not info then return end
|
||||||
|
TriggerClientEvent("ND_Vehicles:blip", src, info.netId, true)
|
||||||
|
|
||||||
if vehicle.impounded then
|
if vehicle.impounded then
|
||||||
local reclaimPrice = vehicle.metadata.impoundReclaimPrice or 200
|
local reclaimPrice = vehicle.metadata.impoundReclaimPrice or 200
|
||||||
if not player.deductMoney("bank", reclaimPrice, "Vehicle impound reclaim") then
|
if not player.deductMoney("bank", reclaimPrice, "Vehicle impound reclaim") then
|
||||||
@@ -719,10 +725,6 @@ RegisterNetEvent("ND_Vehicles:takeVehicle", function(vehId, locations)
|
|||||||
})
|
})
|
||||||
MySQL.query.await("UPDATE nd_vehicles SET impounded = ? WHERE id = ?", {0, vehicle.id})
|
MySQL.query.await("UPDATE nd_vehicles SET impounded = ? WHERE id = ?", {0, vehicle.id})
|
||||||
end
|
end
|
||||||
|
|
||||||
local info = NDCore.spawnOwnedVehicle(src, vehicle.id, isParkingAvailable(locations))
|
|
||||||
if not info then return end
|
|
||||||
TriggerClientEvent("ND_Vehicles:blip", src, info.netId, true)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
lib.callback.register("ND_Vehicles:getOwnedVehicles", function(src)
|
lib.callback.register("ND_Vehicles:getOwnedVehicles", function(src)
|
||||||
|
|||||||
Reference in New Issue
Block a user