600er Posted January 12, 2012 Share Posted January 12, 2012 Hey guys! Can you help me fix my gate pls? I have done it, and the doors open on radius. But when they close they stay like that. When I come closer then the gates just teleport to the open position. I want to make it to open slowly. This is my first gate using the "setElementRotation". I have used the "moveObjet" till now only. So please help me! Here is my code: Door1 = createObject ( 3050, 1459, -1492.599, 14.8, 0, 0, 74.998 ) Door2 = createObject ( 3049, 1456.599, -1501.399, 14.8, 0, 0, 254.745 ) Doorscol = createColCircle ( 1457.88, -1497.003, 7, 15 ) function openDoors(thePlayer) if getElementModel( thePlayer ) == 241 or 292 or 305 or 309 or 50 then setElementRotation (Door1, 0, 0, 331.748 ) setElementRotation (Door2, 0, 0, 3.495 ) end end addEventHandler( "onColShapeHit", Doorscol, openDoors ) function closeDoors(thePlayer) if getElementModel( thePlayer ) == 241 or 292 or 305 or 309 or 50 then setElementRotation (Door1, 0, 0, 74.998 ) setElementRotation (Door2, 0, 0, 254.745 ) end end addEventHandler( "onColShapeLeave", Doorscol, closeDoors ) Link to comment
Castillo Posted January 12, 2012 Share Posted January 12, 2012 He's saying that the gate is not moving to the position, is teleporting to it. That's because you're using: setElementPosition instead of moveObject. Door1 = createObject ( 3050, 1459, -1492.599, 14.8, 0, 0, 74.998 ) Door2 = createObject ( 3049, 1456.599, -1501.399, 14.8, 0, 0, 254.745 ) Doorscol = createColCircle ( 1457.88, -1497.003, 7, 15 ) local validSkins = {[241] = true, [292] = true, [305] = true, [309] = true, [50] = true} function openDoors(thePlayer) if validSkins[getElementModel( thePlayer )] then moveObject(Door1, 3000, 1459, -1489.599, 14. moveObject(Door2, 3000, 1456.599, -1504.399, 14. end end addEventHandler( "onColShapeHit", Doorscol, openDoors ) function closeDoors(thePlayer) if validSkins[getElementModel( thePlayer )] then moveObject(Door1, 3000, 1459, -1492.599, 14. moveObject(Door2, 3000, 1456.599, -1501.399, 14. end end addEventHandler( "onColShapeLeave", Doorscol, closeDoors ) Btw, you'll have to set the correct position, current one's aren't right. Link to comment
600er Posted January 12, 2012 Author Share Posted January 12, 2012 Castillo, The one you did just moves the door. What i need it to rotate it to an angle, Cuz moving it wount do that work, thats why i need setElementRotation Link to comment
Castillo Posted January 12, 2012 Share Posted January 12, 2012 moveObject has rotation arguments too, just specify them right. https://wiki.multitheftauto.com/wiki/MoveObject Link to comment
600er Posted January 12, 2012 Author Share Posted January 12, 2012 Hey wait, i think i know how.. hmm... If I add +00.001 to every gate on moveObject, I may get what i want.. Need to try that tomorrow! 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