Files
Elite-Gaming-FiveM/resources/CarWipe/client/client.lua
T
Jacob 8e00e0890f Automatic server cleanup every hour.
+ Added CarWipe which automatically clears all the vehicles in the server every hour.
+ Can also use /delall to manually initiate it.
2022-04-23 18:36:49 +01:00

76 lines
3.3 KiB
Lua

RegisterNetEvent("delall")
AddEventHandler("delall", function ()
if Config.alerts then
TriggerEvent("chatMessage", '', {255, 255, 255}, "^*^4[^8System^4]:^7 Vehicles will be wiped in 1 minute. Stay in your vehicle if you do not want it to be deleted.")
Citizen.Wait(30000)
TriggerEvent("chatMessage", '', {255, 255, 255}, "^*^4[^8System^4]:^7 Vehicles will be wiped in 30 seconds. Stay in your vehicle if you do not want it to be deleted.")
Citizen.Wait(25000)
TriggerEvent("chatMessage", '', {255, 255, 255}, "^*^4[^8System^4]:^7 Vehicles will be wiped in 5 seconds. Stay in your vehicle if you do not want it to be deleted.")
Citizen.Wait(5000)
end
Citizen.Wait(1000)
for vehicle in EnumerateVehicles() do
if (not IsPedAPlayer(GetPedInVehicleSeat(vehicle, -1))) then
if Config.OnlyWipeBroken == true then
if GetVehicleEngineHealth(vehicle) <= 100.0 then
SetVehicleHasBeenOwnedByPlayer(vehicle, false)
SetEntityAsMissionEntity(vehicle, false, false)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
if (DoesEntityExist(vehicle)) then
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
end
end
else
SetVehicleHasBeenOwnedByPlayer(vehicle, false)
SetEntityAsMissionEntity(vehicle, false, false)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
if (DoesEntityExist(vehicle)) then
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
DeleteVehicle(vehicle)
if Config.UseESX then
ESX.Game.DeleteVehicle(vehicle)
end
DeleteEntity(vehicle)
end
end
if Config.use10msdelay then
Citizen.Wait(10)
end
end
end
if Config.DoneNotify then
TriggerEvent("chatMessage", '', {255, 255, 255}, "^*^4[^8System^4]:^1 Vehicles have been wiped!")
end
end)