joedajoester Posted November 23, 2011 Share Posted November 23, 2011 Hi, this script i need a gate to rotate up and if someone goes in the gate and leaves the collision zone before the gate fully opens the gate glitches and closes above where it should close. In the wiki its adding rotation not setting it. https://wiki.multitheftauto.com/wiki/MoveObject see? its retarded and that's the only gate in my server that uses rotation. col = createColTube ( 2919.8000488281, -790.9, 10.300000190735, 20, 20) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. root = getRootElement () lift = createObject ( 968, 2919.8000488281, -790.9, 11.300000190735, 0, -90, 88) -- enter the ID of the object followed by the coordinates -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. function Open (pla) if getElementType ( pla ) == "player" then --here you can alter the group from Admin to whatever you require in your server but remember the rest must be the same i.e change everything where it says Admin to your desired group and add the users to that group. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then moveObject (lift, 2500, 2919.8000488281, -790.9, 11.300000190735, 0, 90, 0, "OutBack") -- here is where you enter the coordinatess of the new location of the object, 2500 = the speed of the movent. end end end addEventHandler ( "onColShapeHit", col, Open) addEventHandler ( "Open", root, Open) function Close ( pla ) if getElementType ( pla ) == "player" then if vehicle or not vehicle then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then moveObject (lift, 3500, 2919.8000488281, -790.8, 11.300000190735, 0, -90, 0, "InBack") -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. else return 0 end end end end addEventHandler ( "onColShapeLeave", col, Close ) addEventHandler ( "Close", root, Close) Link to comment
unknooooown Posted November 23, 2011 Share Posted November 23, 2011 Hi, this script i need a gate to rotate up and if someone goes in the gate and leaves the collision zone before the gate fully opens the gate glitches and closes above where it should close. In the wiki its adding rotation not setting it. https://wiki.multitheftauto.com/wiki/MoveObject see? its retarded and that's the only gate in my server that uses rotation. https://wiki.multitheftauto.com/wiki/SetElementRotation Also, root is a predefined variable in MTA, so you DON'T have to: root = getRootElement () Link to comment
joedajoester Posted November 23, 2011 Author Share Posted November 23, 2011 soo this? col = createColTube ( 2919.8000488281, -790.9, 10.300000190735, 15, 13) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. root = getRootElement () lift = createObject ( 968, 2919.8000488281, -790.9, 11.300000190735, 0, -90, 88) -- enter the ID of the object followed by the coordinates -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. function Open (pla) if getElementType ( pla ) == "player" then --here you can alter the group from Admin to whatever you require in your server but remember the rest must be the same i.e change everything where it says Admin to your desired group and add the users to that group. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then setElementRotation(lift, 0, 0, 0) -- here is where you enter the coordinatess of the new location of the object, 2500 = the speed of the movent. end end end addEventHandler ( "onColShapeHit", col, Open) addEventHandler ( "Open", root, Open) function Close ( pla ) if getElementType ( pla ) == "player" then if vehicle or not vehicle then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then moveObject (lift, 1500, 2919.8000488281, -790.8, 11.300000190735, 0, -90, 0, "InBack") -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. else return 0 end end end end addEventHandler ( "onColShapeLeave", col, Close ) addEventHandler ( "Close", root, Close) Link to comment
Castillo Posted November 23, 2011 Share Posted November 23, 2011 You don't need these: addEventHandler ( "Close", root, Close) addEventHandler ( "Open", root, Open) Link to comment
joedajoester Posted November 23, 2011 Author Share Posted November 23, 2011 Umm ok but how would i fix the glitch? I used set element rotation and it doesnt have a transition, look. col = createColTube ( 2919.8000488281, -790.9, 10.300000190735, 15, 13) -- enter your cooderates here for your colshape please note 10 and 3 is to do with the size of the shape. root = getRootElement () lift = createObject ( 968, 2919.8000488281, -790.9, 11.300000190735, 0, -90, 88) -- enter the ID of the object followed by the coordinates -- note the rotx y and z may not be required so you just remove these. x y and z is where you would put your cordinates. function Open (pla) if getElementType ( pla ) == "player" then --here you can alter the group from Admin to whatever you require in your server but remember the rest must be the same i.e change everything where it says Admin to your desired group and add the users to that group. if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then setElementRotation(lift, 0, 0, 88) -- here is where you enter the coordinatess of the new location of the object, 2500 = the speed of the movent. end end end addEventHandler ( "onColShapeHit", col, Open) addEventHandler ( "Open", root, Open) function Close ( pla ) if getElementType ( pla ) == "player" then if vehicle or not vehicle then if isObjectInACLGroup ( "user."..getAccountName(getPlayerAccount(pla)), aclGetGroup ( "Admin" ) ) then setElementRotation(lift, 0, -90, 88) -- here is where you copy the coordinates of the orginal location of the object, 2951 = the timer of movent. else return 0 end end end end addEventHandler ( "onColShapeLeave", col, Close ) addEventHandler ( "Close", root, Close) Link to comment
Aibo Posted November 24, 2011 Share Posted November 24, 2011 setElementRotation() doesnt do transitions, it just snaps the element into place. you can try to get object's current rotation when/if its still moving, do stopObject() and then calculate the needed rotation offset for new moveObject call. but it probably wont be correct with easing there. Link to comment
unknooooown Posted November 24, 2011 Share Posted November 24, 2011 setElementRotation() doesnt do transitions, it just snaps the element into place.you can try to get object's current rotation when/if its still moving, do stopObject() and then calculate the needed rotation offset for new moveObject call. but it probably wont be correct with easing there. He was asking for: In the wiki its adding rotation not setting it. Only thing I could think of that does that, is setElementRotation. 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