c12kta Posted November 7, 2014 Posted November 7, 2014 (edited) anyone here can make moving gate script but the password must same for opening and closing the gate , i have the script for moving gate but the password did not same , sorry for my bad english this my moving gate script function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) end addCommandHandler("open",openMyGate1) function movingMyGateBack1 () moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) end addCommandHandler("close",movingMyGateBack1) thanks for helping Edited November 7, 2014 by Guest
Ab-47 Posted November 7, 2014 Posted November 7, 2014 Well, if your gate isn't opening I guess you're unaware that you've included an irrelevant character in your command handler; addCommandHandler("'open",openMyGate1) change that with; addCommandHandler("open",openMyGate1) Though, password is basically a code, a code that other people aren't aware of. 'open' and 'close' are common words people use to commit that command, but you can also change these words to something other people aren't aware of. There's your password solution, change your command handler command to whatever your password is, i.e; [/lua]addCommandHandler("123456",openMyGate1)[/lua] The code shall open using the command /123456 or if you want a more unique system like an edit box and accept button, try GUI elements, functions etc.
c12kta Posted November 7, 2014 Author Posted November 7, 2014 Well, if your gate isn't opening I guess you're unaware that you've included an irrelevant character in your command handler; addCommandHandler("'open",openMyGate1) change that with; addCommandHandler("open",openMyGate1) Though, password is basically a code, a code that other people aren't aware of. 'open' and 'close' are common words people use to commit that command, but you can also change these words to something other people aren't aware of. There's your password solution, change your command handler command to whatever your password is, i.e; [/lua]addCommandHandler("123456",openMyGate1)[/lua] The code shall open using the command /123456 or if you want a more unique system like an edit box and accept button, try GUI elements, functions etc. sorry sir , the password "open / close" it just as an example, what I mean here is how to get the gate closed and opened with one same password, as an example, I want to open the gate to move with one command, / gatepassword and I want to close with the command / gatepassword as well
-.Paradox.- Posted November 7, 2014 Posted November 7, 2014 viewtopic.php?f=91&t=76900&p=705672#p705672
Ab-47 Posted November 8, 2014 Posted November 8, 2014 Well, if your gate isn't opening I guess you're unaware that you've included an irrelevant character in your command handler; addCommandHandler("'open",openMyGate1) change that with; addCommandHandler("open",openMyGate1) Though, password is basically a code, a code that other people aren't aware of. 'open' and 'close' are common words people use to commit that command, but you can also change these words to something other people aren't aware of. There's your password solution, change your command handler command to whatever your password is, i.e; addCommandHandler("123456",openMyGate1) The code shall open using the command /123456 or if you want a more unique system like an edit box and accept button, try GUI elements, functions etc. sorry sir , the password "open / close" it just as an example, what I mean here is how to get the gate closed and opened with one same password, as an example, I want to open the gate to move with one command, / gatepassword and I want to close with the command / gatepassword as well Okay.. local gateOpen = false function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () if (gateOpen == false) then moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) gateOpen = true else moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) gateOpen = false end addCommandHandler("yourcommand",openMyGate1) That?
c12kta Posted November 8, 2014 Author Posted November 8, 2014 Well, if your gate isn't opening I guess you're unaware that you've included an irrelevant character in your command handler; addCommandHandler("'open",openMyGate1) change that with; addCommandHandler("open",openMyGate1) Though, password is basically a code, a code that other people aren't aware of. 'open' and 'close' are common words people use to commit that command, but you can also change these words to something other people aren't aware of. There's your password solution, change your command handler command to whatever your password is, i.e; addCommandHandler("123456",openMyGate1) The code shall open using the command /123456 or if you want a more unique system like an edit box and accept button, try GUI elements, functions etc. sorry sir , the password "open / close" it just as an example, what I mean here is how to get the gate closed and opened with one same password, as an example, I want to open the gate to move with one command, / gatepassword and I want to close with the command / gatepassword as well Okay.. local gateOpen = false function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () if (gateOpen == false) then moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) gateOpen = true else moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) gateOpen = false end addCommandHandler("yourcommand",openMyGate1) That? I got This when i try to run this script , can you fix it??
SkatCh Posted November 8, 2014 Posted November 8, 2014 You must add an other end to close the function that's all : local gateOpen = false function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () if (gateOpen == false) then moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) gateOpen = true else moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) gateOpen = false end end addCommandHandler("yourcommand",openMyGate1)
c12kta Posted November 8, 2014 Author Posted November 8, 2014 You must add an other end to close the function that's all : local gateOpen = false function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () if (gateOpen == false) then moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) gateOpen = true else moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) gateOpen = false end end addCommandHandler("yourcommand",openMyGate1) thanks sir , it works
Ab-47 Posted November 10, 2014 Posted November 10, 2014 Okay.. local gateOpen = false function createTheGate1 () myGate1 = createObject ( 987, 2500.7998046875, -1520.400390625, 22.700000762939, 270, 90, 90 ) myGate2 = createObject ( 987, 2500.7998046875, -1525.400390625, 22.700000762939, 270, 90, 90 ) myGate3 = createObject ( 987, 2500.7998046875, -1531.2001953125, 22.700000762939, 270, 90, 90 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createTheGate1 ) function openMyGate1 () if (gateOpen == false) then moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 19.5, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 17.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 16, 0, 0, 0 ) gateOpen = true else moveObject ( myGate1, 1500, 2500.7998046875, -1520.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate2, 1500, 2500.7998046875, -1525.400390625, 22.700000762939, 0, 0, 0 ) moveObject ( myGate3, 1500, 2500.7998046875, -1531.2001953125, 22.700000762939, 0, 0, 0 ) gateOpen = false end addCommandHandler("yourcommand",openMyGate1) That? I got This when i try to run this script , can you fix it?? So sorry mate, forgot to close the 'if' statement with an 'end'. But your problem is solved now
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