Fox261098 Posted January 1, 2017 Share Posted January 1, 2017 Hello i made a gate the gate is in lv but i can open it in ls so how to make so it opens just when u in front of the gate local gate = createObject(10828,1838.3000488281,908.90002441406,22.10000038147,0,0,90); local thegang = "TheGhosts"; addCommandHandler("ogate", function(player) local gang = getElementData(player, "gang") or false; if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,941.79998779297,22.10000038147); end end); addCommandHandler("cgate", function(player) local gang = getElementData(player, "gang") or false; if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,908.90002441406,22.10000038147); end end); Link to comment
rapgod1 Posted January 1, 2017 Share Posted January 1, 2017 You can use this: getDistanceBetweenPoints3D Link to comment
Fox261098 Posted January 1, 2017 Author Share Posted January 1, 2017 Im new at scripting so can u help me put it in my script ? Link to comment
Miika Posted January 1, 2017 Share Posted January 1, 2017 (edited) local gate = createObject(10828,1838.3000488281,908.90002441406,22.10000038147,0,0,90) local col = createColSphere(1838.3000488281,908.90002441406,22.10000038147, 4) local thegang = "TheGhosts" addEventHandler("onColShapeHit", col, function(hitElement) if getElementType(hitElement) == "player" then local gang = getElementData(hitElement, "gang") if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,941.79998779297,22.10000038147) end end end) addEventHandler("onColShapeLeave", col, function(hitElement) if getElementType(hitElement) == "player" then local gang = getElementData(hitElement, "gang") if (gang and gang == thegang) then moveObject(gate, 4000,1838.3000488281,908.90002441406,22.10000038147) end end end) Try it Also, those ' ; ' are not needed in lua. Edited January 1, 2017 by Miika822 Link to comment
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