Jump to content

Anti vehicle zone


TorNix~|nR

Recommended Posts

Posted (edited)

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
Posted

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

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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...