Jump to content

Police Gate // Smash Bar [Help!]


Seaton

Recommended Posts

Alright, in MTA theres the "smashbar" object, which I believe is the one that on msot servers is used that raises upwards to open up, if not correct me with the name of the proper one, what i'm asking is.. what do I need to do, to construct this gate, do I only need the bar?

Also, how do you any door, like Airport door and what-not.

sorry this is my first day with MTA.

Link to comment

this should be at the scripting section but yes.

local openArea = createColCuboid(x,y,z,width,depth,height) --you need to replace x,y,z,width,depth,height here
local door = createObject(modelid,x,y,z,rotx,roty,rotz)	--you need to replace modelid,x,y,z,rotx,roty,rotz here
 
 
function openTheDoor(element)
local move = false
if getElementType(element) == "player" then
	move = true
elseif getElementType(element) == "vehicle" then
if getVehicleOccupant(element,0) then
		move = true
end
end
 
if move then
moveObject(door,timetomove,x,y,z,rotx,roty,rotz) --you need to replace timetomove,x,y,z,rotx,roty,rotz here
end
end
addEventHandler("onColShapeHit",openArea,openTheDoor)
 
function closeTheDoor(element)
local move = true
for i,v in ipairs(getElementsWithinColShape(openArea)) do
if getElementType(v) == "player" then
		move = false
break
elseif getElementType(v) == "vehicle" then
if getVehicleOccupant(v,0) then
			move = false
break
end
end
end
 
if move then
moveObject(door,timetomove,oldx,oldy,oldz,oldrotx,oldroty,oldrotz) --you need to replace timetomove,oldx,oldy,oldz,oldrotx,oldroty,oldrotz here
end
end
addEventHandler("onColShapeLeave",openArea,closeTheDoor)

untested and of course you have to place all the values correctly in order to make it work.

if you need further help, just ask

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