Jump to content

Gate that closes automatically [HELP]


Recommended Posts

Hi guys,

i have made a script for Open and close the gate, but i want this gate it closes by itself.

My code:

local gate = createObject ( 969, 209.69999694824, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
local state = false 
  
addCommandHandler ( "op", 
    function ( thePlayer ) 
        if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Everyone" ) ) then 
            if ( not state ) then 
            outputChatBox("Portail de protection DESACTIVER !",thePlayer, 255,0,0,false) 
                moveObject ( gate, 3000, 218, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
            else                 
                moveObject ( gate, 3000, 209.69999694824, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
            outputChatBox("Portail de protection ACTIVER !",thePlayer, 17,251,0,false) 
            end 
            state = ( not state ) 
            else 
            outputChatBox("Vous n'êtes pas un membres enregistré du serveur !",thePlayer,235,0,0,true) 
        end 
    end 
) 

Sorry for my english, i'm french.

Link to comment

Closes after 5 seconds.

local gate = createObject ( 969, 209.69999694824, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
local state = false 
  
addCommandHandler ( "op", 
    function ( thePlayer ) 
        if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Everyone" ) ) then 
            if ( not state ) then 
                outputChatBox("Portail de protection DESACTIVER !",thePlayer, 255,0,0,false) 
                moveObject ( gate, 3000, 218, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
                setTimer(function() moveObject ( gate, 3000, 209.69999694824, 1875.3000488281, 12.10000038147, 0, 0, 0 ) state = false end, 5000, 1) 
            else                 
                moveObject ( gate, 3000, 209.69999694824, 1875.3000488281, 12.10000038147, 0, 0, 0 ) 
                outputChatBox("Portail de protection ACTIVER !",thePlayer, 17,251,0,false) 
            end 
            state = ( not state ) 
        else 
            outputChatBox("Vous n'êtes pas un membres enregistré du serveur !",thePlayer,235,0,0,true) 
        end 
    end 
) 

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