Alen141 Posted November 11, 2013 Share Posted November 11, 2013 Hey there I just wanted to know which functions do I need to use to create a door/gates that open only when certain team tries to enter( I don't want it to open using command ) Link to comment
mint3d Posted November 11, 2013 Share Posted November 11, 2013 You want automatic gates? Link to comment
Alen141 Posted November 11, 2013 Author Share Posted November 11, 2013 You want automatic gates? yep Link to comment
mint3d Posted November 11, 2013 Share Posted November 11, 2013 createObject moveObject You will need these 2 functions and you might need another but I am not sure which one if you want command then local Gate = { [1] = createObject(980, 1091, 2554, 20, 0, 0, 325) } local GateName = "" local open = false local function ResetOpenState() open = false end local function closeDoor(thePlayer) if (getElementType(thePlayer)) then outputChatBox("The " .. GateName .. " are now Closed!", thePlayer, 255, 0, 0) end moveObject(Gate[1], 1000, 1091, 2554, 20, 0, 0, 0) setTimer(ResetOpenState, 1000, 1) end -- Gate code / Using local functions to avoid local function useDoor(thePlayer, commandName, ...) local password = table.concat({...}) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(1091, 2554, 20, x, y, z) if (distance<=20) and (open==false) then outputChatBox("The " .. GateName .. " are now open!", thePlayer, 0, 255, 0) moveObject(Gate[1], 1000, 0, 2554, 0, 0, 0, 0) setTimer(closeDoor, 5000, 1, thePlayer) open = true else outputChatBox("You need a to be in.... ", thePlayer, 255, 0, 0) end end addCommandHandler("command", useDoor) Just swap x y z and stuff Link to comment
tosfera Posted November 11, 2013 Share Posted November 11, 2013 createObject moveObject You will need these 2 functions and you might need another but I am not sure which one if you want command then local Gate = { [1] = createObject(980, 1091, 2554, 20, 0, 0, 325) } local GateName = "" local open = false local function ResetOpenState() open = false end local function closeDoor(thePlayer) if (getElementType(thePlayer)) then outputChatBox("The " .. GateName .. " are now Closed!", thePlayer, 255, 0, 0) end moveObject(Gate[1], 1000, 1091, 2554, 20, 0, 0, 0) setTimer(ResetOpenState, 1000, 1) end -- Gate code / Using local functions to avoid local function useDoor(thePlayer, commandName, ...) local password = table.concat({...}) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(1091, 2554, 20, x, y, z) if (distance<=20) and (open==false) then outputChatBox("The " .. GateName .. " are now open!", thePlayer, 0, 255, 0) moveObject(Gate[1], 1000, 0, 2554, 0, 0, 0, 0) setTimer(closeDoor, 5000, 1, thePlayer) open = true else outputChatBox("You need a to be in.... ", thePlayer, 255, 0, 0) end end addCommandHandler("command", useDoor) Just swap x y z and stuff That's the most rubbish and failing script I've ever seen, sorry. This will only work for 1 gate, can't add another one without renaming your 'open', spamming the command may result in crashes or misbehaving doors. Your chatbox messages are at the level of a 4 years old kid. Link to comment
mint3d Posted November 11, 2013 Share Posted November 11, 2013 Maybe read it Fag you can add another gate and your grammar is shit along with your spelling Link to comment
tosfera Posted November 11, 2013 Share Posted November 11, 2013 Maybe read it you can add another gate and your grammar is :~ along with your spelling reading it makes me throw up 'cause it's full of bugs, nuf said. Link to comment
mint3d Posted November 11, 2013 Share Posted November 11, 2013 Works fine and it has no bugs so ye work that out Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now