SjoerdPSV Posted July 6, 2013 Posted July 6, 2013 Hey all, I got this script. When I start this the object is created but if I type /carrier1, notthing happens. Does anybody know what's wrong in this script? local gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) function moveGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.89999961853) setTimer(moveBack, 20000, 1) end end addCommandHandler('carrier1', moveGate) function moveBack() moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onStartup)
HunT Posted July 6, 2013 Posted July 6, 2013 Tested : Server Side gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) function moveGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 16.89999961853) setTimer(moveBack, 20000, 1) end end addCommandHandler('carrier1', moveGate) function moveBack() moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) end 1: u no need "local gate = createObject" but only "gate = createObject" 2: u forget set the position z on move object
Castillo Posted July 6, 2013 Posted July 6, 2013 There's no point on creating a function to move it back, you can use moveObject with the timer. local gate = createObject ( 3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0 ) function moveGate ( psource ) local Deadusergroup = getAccountName ( getPlayerAccount ( psource ) ) if isObjectInACLGroup ( "user."..Deadusergroup, aclGetGroup ( "Admin" ) ) then moveObject ( gate, 8000, -1456.8000488281, 501.39999389648, 16.9 ) setTimer ( moveObject, 20000, 1, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303 ) end end addCommandHandler ( 'carrier1', moveGate )
HunT Posted July 6, 2013 Posted July 6, 2013 If u want use the command for open and close the gate without timer. gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) state = "close" function moveTheGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) and state == "close" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 16.89999961853) state = "open" elseif state == "open" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) state = "close" end end addCommandHandler('carrier1', moveTheGate) with /carrier1 u can open and close the gate
-.Paradox.- Posted July 6, 2013 Posted July 6, 2013 If u want use the command for open and close the gate without timer. gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) state = "close" function moveTheGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) and state == "close" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 16.89999961853) state = "open" elseif state == "open" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) state = "close" end end addCommandHandler('carrier1', moveTheGate) with /carrier1 u can open and close the gate the error is in createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) as you can see 3115 is the id of gate, and here he's using 8000, -1456.8000488281, 501.39999389648, 9.8999996185303 he used id of gate 8000 he need to put 3115 like that 3115, -1456.8000488281, 501.39999389648, 9.8999996185303
Castillo Posted July 6, 2013 Posted July 6, 2013 Why do you need to post something without even knowing what you're talking about? the second argument of moveObject is the TIME, not the model ID, why would it need a model ID?
iMr.3a[Z]eF Posted July 6, 2013 Posted July 6, 2013 If u want use the command for open and close the gate without timer. gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) state = "close" function moveTheGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) and state == "close" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 16.89999961853) state = "open" elseif state == "open" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) state = "close" end end addCommandHandler('carrier1', moveTheGate) with /carrier1 u can open and close the gate "state" isn't defined
Castillo Posted July 6, 2013 Posted July 6, 2013 If u want use the command for open and close the gate without timer. gate = createObject(3115, -1456.8000488281, 501.39999389648, 9.8999996185303, 0, 0, 0) state = "close" function moveTheGate(psource) local Deadusergroup = getAccountName(getPlayerAccount(psource)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup("Admin")) and state == "close" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 16.89999961853) state = "open" elseif state == "open" then moveObject(gate, 8000, -1456.8000488281, 501.39999389648, 9.8999996185303) state = "close" end end addCommandHandler('carrier1', moveTheGate) with /carrier1 u can open and close the gate "state" isn't defined Don't take this the wrong way, but are you blind? it's defined just before the function.
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