forked from Project-Sloth/ps-mdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added files from the original fork from Flaws, doing this because we could no start issues because it was a fork.
- Loading branch information
1 parent
9882603
commit 2d99ad8
Showing
21 changed files
with
14,855 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.