Jump to content

Gates script[HELP]


Alen141

Recommended Posts

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

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