Jump to content

Anti vehicle zone


TorNix~|nR

Recommended Posts

You can create a colshape, and use onColShapeHit and destroyElement to destroy the vehicles when they enter the area.

Something like this:

x,= 1000, 500 --example; change this to your own.
cWidth, cHeight = 30, 20 --width and height for the colshape; change this to your own.
myCol = createColRectangle (x, y, cWidth, cHeight)

function destroyTheVehicles (player)
	if getElementType (player) == "player" and isElementInVehicle (player) then
		destroyElement (getPedOccupiedVehicle (player))
		outputChatBox ("Vehicles are not allowed here!", player, 255, 0, 0)
	end
end
addEventHandler ("onColShapeHit", myCol, destroyTheVehicles)

 

Edited by EstrategiaGTA
Link to comment

I replace it here

local myCol = createColRectangle (1000, 500, 30, 20)

function destroyTheVehicles (player)
	if getElementType (player) == "player" and isPedInVehicle (player) then
		destroyElement (getPedOccupiedVehicle (player))
		outputChatBox ("Vehicles are not allowed here!", player, 255, 0, 0)
	end
end
addEventHandler ("onColShapeHit", myCol, destroyTheVehicles)

 

  • Like 1
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...