Skip to content

Commit

Permalink
Added original files
Browse files Browse the repository at this point in the history
Added files from the original fork from Flaws, doing this because we could no start issues because it was a fork.
  • Loading branch information
MonkeyWhisper authored Apr 1, 2022
1 parent 9882603 commit 2d99ad8
Show file tree
Hide file tree
Showing 21 changed files with 14,855 additions and 0 deletions.
75 changes: 75 additions & 0 deletions client/cl_impound.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
local currentGarage = 1

local function doCarDamage(currentVehicle, veh)
local smash = false
local damageOutside = false
local damageOutside2 = false
local engine = veh.engine + 0.0
local body = veh.body + 0.0

if engine < 200.0 then engine = 200.0 end
if engine > 1000.0 then engine = 950.0 end
if body < 150.0 then body = 150.0 end
if body < 950.0 then smash = true end
if body < 920.0 then damageOutside = true end
if body < 920.0 then damageOutside2 = true end

Citizen.Wait(100)
SetVehicleEngineHealth(currentVehicle, engine)

if smash then
SmashVehicleWindow(currentVehicle, 0)
SmashVehicleWindow(currentVehicle, 1)
SmashVehicleWindow(currentVehicle, 2)
SmashVehicleWindow(currentVehicle, 3)
SmashVehicleWindow(currentVehicle, 4)
end

if damageOutside then
SetVehicleDoorBroken(currentVehicle, 1, true)
SetVehicleDoorBroken(currentVehicle, 6, true)
SetVehicleDoorBroken(currentVehicle, 4, true)
end

if damageOutside2 then
SetVehicleTyreBurst(currentVehicle, 1, false, 990.0)
SetVehicleTyreBurst(currentVehicle, 2, false, 990.0)
SetVehicleTyreBurst(currentVehicle, 3, false, 990.0)
SetVehicleTyreBurst(currentVehicle, 4, false, 990.0)
end

if body < 1000 then
SetVehicleBodyHealth(currentVehicle, 985.1)
end
end

local function TakeOutImpound(vehicle)
local coords = Config.ImpoundLocations[currentGarage]
if coords then
QBCore.Functions.SpawnVehicle(vehicle.vehicle, function(veh)
QBCore.Functions.TriggerCallback('qb-garage:server:GetVehicleProperties', function(properties)
QBCore.Functions.SetVehicleProperties(veh, properties)
SetVehicleNumberPlateText(veh, vehicle.plate)
SetEntityHeading(veh, coords.w)
exports[Config.Fuel]:SetFuel(veh, vehicle.fuel)
doCarDamage(veh, vehicle)
TriggerServerEvent('police:server:TakeOutImpound',vehicle.plate)
TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh))
SetVehicleEngineOn(veh, true, true)
end, vehicle.plate)
end, coords, true)
end
end

RegisterNetEvent('qb-mdt:client:TakeOutImpound', function(data)
local pos = GetEntityCoords(PlayerPedId())
currentGarage = data.currentSelection
local takeDist = Config.ImpoundLocations[data.currentSelection]
takeDist = vector3(takeDist.x, takeDist.y, takeDist.z)
if #(pos - takeDist) <= 15.0 then
local vehicle = data.vehicle
TakeOutImpound(data)
else
QBCore.Functions.Notify("You are too far away from the impound location!")
end
end)
Loading

0 comments on commit 2d99ad8

Please sign in to comment.