tweak(server/vehicle): reclaiming impounded veh

This commit is contained in:
Andyyy7666
2023-10-29 11:23:05 +01:00
parent cebe404d42
commit a8c5ea7d79

View File

@@ -666,17 +666,8 @@ RegisterNetEvent("ND_Vehicles:takeVehicle", function(vehId, locations)
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
if vehicle.impounded then if vehicle.impounded then
local reclaimPrice = 200 local reclaimPrice = vehicle.metadata.impoundReclaimPrice or 200
if player.deductMoney("bank", reclaimPrice, "Vehicle impound reclaim") then if not player.deductMoney("bank", reclaimPrice, "Vehicle impound reclaim") then
MySQL.query("UPDATE nd_vehicles SET impounded = ? WHERE id = ?", {0, vehicle.id})
player.notify({
title = "Impound",
description = ("Paid $%d to reclaim vehicle!"):format(reclaimPrice),
type = "success",
position = "bottom"
})
Wait(500)
else
return player.notify({ return player.notify({
title = "Impound", title = "Impound",
description = ("Price to reclaim is $%d, you don't have enough!"):format(reclaimPrice), description = ("Price to reclaim is $%d, you don't have enough!"):format(reclaimPrice),
@@ -684,6 +675,13 @@ RegisterNetEvent("ND_Vehicles:takeVehicle", function(vehId, locations)
position = "bottom" position = "bottom"
}) })
end end
player.notify({
title = "Impound",
description = ("Paid $%d to reclaim vehicle!"):format(reclaimPrice),
type = "success",
position = "bottom"
})
MySQL.query.await("UPDATE nd_vehicles SET impounded = ? WHERE id = ?", {0, vehicle.id})
end end
local info = NDCore.spawnOwnedVehicle(src, vehicle.id, isParkingAvailable(locations)) local info = NDCore.spawnOwnedVehicle(src, vehicle.id, isParkingAvailable(locations))