Jump to content

Destroy vehicle


Parazitas

Recommended Posts

Hello im trying to make script who destroys all empty fagio in map after some time. maybe some help?
function deletefag()
 vehicles = getElementsByType("vehicle")
 for i,v in ipairs(vehicles) do
if (getElementModel(v) == modelID) then
destroyElement(v)
end
end
end
setTimer(deletefag, 5000, 0)
deletefag(462)
 

Link to comment
function DestroyAllFagios(playerSource)
	local allVehicles = getElementsByType("Vehicle")
	for i,v in ipairs(allVehicles) do
		if getElementModel(v) == 462 then
			local counter = 0
			for seat, player in pairs(getVehicleOccupants(v)) do
				counter = counter + 1
			end
			if counter == 0 then
				blowVehicle(v)
			end
		end
	end
end
addCommandHandler("destroyfagios", DestroyAllFagios)

Something like this would work! Good Luck!

Edited by Crossy101
Link to comment
35 minutes ago, Crossy101 said:

function DestroyAllFagios(playerSource)
	local allVehicles = getElementsByType("Vehicle")
	for i,v in ipairs(allVehicles) do
		if getElementModel(v) == 462 then
			local counter = 0
			for seat, player in pairs(getVehicleOccupants(v)) do
				counter = counter + 1
			end
			if counter == 0 then
				blowVehicle(v)
			end
		end
	end
end
addCommandHandler("destroyfagios", DestroyAllFagios)

Something like this would work! Good Luck!

Just add:

SetTimer(5000, DestroyAllFagios, 1)

to the bottom of the function!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...