Deleting all Cars/Planes/Vehicles in general

Hello, looking for a script that, with a command, lets us delete all vehicles in the game. Getting kinda tired of people coming on our server and spamming random vehicles completely ruining the role-play experience

I don’t understand, do you want a command to delete ALL the vehicles of the map / or the spawned vehicles ?

Spawned vehicles.

people coming on our server and spamming random vehicles

It might be what you want, you can also add some verifications to check if the user is admin or anything else…

local modelBlacklist = {"rhino", "lazer", "deluxo", "thruster", "khanjali", "barrage", "volatol", "hydra", "buzzard", "savage", "valkyrie", "apc", "akula", "bombuska", "tula", "hunter", "stromberg", "chernobog", "avenger", "avenger2"}
local function VehicleCheck(ped)
	local entityVeh = GetVehiclePedIsIn(ped)
	if entityVeh and tableHasValue(modelBlacklist, string.lower(GetDisplayNameFromVehicleModel(GetEntityModel(entityVeh)))) then
		DeleteEntity(entityVeh)
		ClearAreaOfVehicles(GetEntityCoords(ped), 1.0)
	end
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(1000)

		VehicleCheck(GetPlayerPed(-1))
	end
end)

You’re better off adding decors to vehicles.

1 Like

what rescource would we put this in^?