DonPro Posted September 19, 2014 Posted September 19, 2014 hi i tryed to make this moving gate to an Command handler, it was an Event Handler. but i wanna keep the ACL group so no one elsn can use the command. i tryed to look on Wiki but i didnt understand how to make it to an Command handler. pleas help me. local gate = createObject(2893, -2055.69, 169.19, 27.89, 343, 0, 90) local marker = createMarker(-2056.60, 171, 27.89, "cylinder", 1, 255, 255, 255, 0) function isAclGroup(p,group) if p and getElementType(p) == "player" and type(group) == "string" then local Deadusergroup = getAccountName(getPlayerAccount(p)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup(group)) then return true else return false end else return false end end function addCommandHandler("lift") then end function moveGate(psource) if isAclGroup(psource,"SamCarTow") then moveObject(gate, 4000, -2055.69, 169.19, 29.89) end end addCommandHandler("onMarkerHit", marker, moveGate) function moveBack(pp) moveObject(gate, 4000, -2055.69, 169.19, 27.89) end addCommandHandler("onMarkerLeave", marker, moveBack)
undefined Posted September 19, 2014 Posted September 19, 2014 (edited) Use /open or /close. Good Luck! local gate = createObject(2893, -2055.69, 169.19, 27.89, 343, 0, 90) local marker = createMarker(-2056.60, 171, 27.89, "cylinder", 1, 255, 255, 255, 0) function isAclGroup(p,group) if p and getElementType(p) == "player" and type(group) == "string" then local Deadusergroup = getAccountName(getPlayerAccount(p)) if isObjectInACLGroup("user."..Deadusergroup, aclGetGroup(group)) then return true else return false end else return false end end function moveGate(playerSource, cmd) if cmd == "open" then if isAclGroup(playerSource,"SamCarTow") then moveObject(gate, 4000, -2055.69, 169.19, 29.89) end elseif cmd == "close" then moveObject(gate, 4000, -2055.69, 169.19, 27.89) end end addCommandHandler("open", moveGate) addCommandHandler("close", moveGate) Edited September 19, 2014 by Guest
Castillo Posted September 19, 2014 Posted September 19, 2014 local gate = createObject(2893, -2055.69, 169.19, 27.89, 343, 0, 90) local gateState = false -- Define a variable with the state of the gate function isAclGroup ( p, group ) if ( p and getElementType ( p ) == "player" and type ( group ) == "string" ) then return isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( p ) ), aclGetGroup ( group ) ) else return false end end function moveGate ( psource ) if isAclGroup ( psource, "SamCarTow" ) then gateState = ( not gateState ) -- Set the state of the gate to the opposite of the current if ( gateState ) then -- If the state is 'true' moveObject ( gate, 4000, -2055.69, 169.19, 29.89 ) -- Open the gate else -- If the state is 'false' moveObject ( gate, 4000, -2055.69, 169.19, 27.89 ) -- Close the gate end end end addCommandHandler ( "lift", movegate )
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