PotatoHead Posted July 19, 2013 Share Posted July 19, 2013 (edited) I have this problem when making gates. The gate just flops around randomly and then ends in a random position. I am not sure what is going on. I am getting no errors. Here is my code. EDIT: I also keep getting a Protocol Error (15) when on my server it happens to everyone when one person disconnects. I am running version 1.3.3 Client and Server. EDIT #2: The Protocol Error (15) was fixed by me just re-installing the server. That Error is now gone. EDIT #3: Problem Fixed. I was just using the wrong parameters to rotate the object. local objGateg = createObject(968, 1544.69995, -1630.80005, 13.1, 0, 269.87, 270.149) exports.pool:allocateElement(objGateg) local open = false -- Gate code function usePDFrontGarageGate(thePlayer) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(1544.69995, -1630.80005, 13.1, x, y, z) if (distance<=10) and (open==false) then if (exports.global:hasItem(thePlayer, 64)) then open = true outputChatBox("LSPD Garage is now Open!", thePlayer, 0, 255, 0) moveObject(objGateg, 3000, 1544.69922, -1630.80005, 13.1, 0, 357.87, 270.148) setTimer(closePDFrontGarageGate, 5000, 1, thePlayer) end end end addCommandHandler("gate", usePDFrontGarageGate) function closePDFrontGarageGate(thePlayer) setTimer(resetState8, 3000, 1) moveObject(objGateg, 3000, 1544.69995, -1630.80005, 13.1, 0, 269.87, 270.149) end function resetState8() open = false end Edited July 21, 2013 by Guest Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 try this: local gx,gy,gz = 1544.69995, -1630.80005, 13.1 local objGateg = createObject(968, gx, gy, gz, 0, 269.87, 270.149) exports.pool:allocateElement(objGateg) local open = false -- Gate code function usePDFrontGarageGate(thePlayer) local x, y, z = getElementPosition(thePlayer) local distance = getDistanceBetweenPoints3D(gx, gy, gz, x, y, z) if (distance<=10) and (open==false) then if (exports.global:hasItem(thePlayer, 64)) then open = true outputChatBox("LSPD Garage is now Open!", thePlayer, 0, 255, 0) moveObject(objGateg, 3000, 1544.69922, -1630.80005, 13.1, 0, 357.87, 270.148) setTimer(closePDFrontGarageGate, 5000, 1) end end end addCommandHandler("gate", usePDFrontGarageGate) function closePDFrontGarageGate() setTimer(function() open = false end, 3000, 1) moveObject(objGateg, 3000, gx, gy, gz, 0, 269.87, 270.149) end Link to comment
PotatoHead Posted July 19, 2013 Author Share Posted July 19, 2013 No that doesn't seem to be working either. It is still flopping about. I am not sure if it is in another script or ot. Link to comment
Jaysds1 Posted July 19, 2013 Share Posted July 19, 2013 (edited) By any chance does it touch any other objects when it's moving? Because the only thing I fixed that with was setting the collision off. setElementCollisionsEnabled Edited July 19, 2013 by Guest Link to comment
PotatoHead Posted July 19, 2013 Author Share Posted July 19, 2013 Just whats is already in the map. I have not mapped anything else around it as of yet. I added that here and it didnt seem to fix it. if (distance<=10) and (open==false) then if (exports.global:hasItem(thePlayer, 64)) then open = true outputChatBox("LSPD Garage is now Open!", thePlayer, 0, 255, 0) moveObject(objGateg, 3000, 1544.69922, -1630.80005, 13.1, 0, 357.87, 270.148) setTimer(closePDFrontGarageGate, 5000, 1) setElementCollisionsEnabled(objgateg, false) end end Link to comment
PotatoHead Posted July 20, 2013 Author Share Posted July 20, 2013 Bump. I really need/want this. I am still new to MTA/LUA scripting so I can not seem to find the problem. Link to comment
Cadu12 Posted July 20, 2013 Share Posted July 20, 2013 Which are you using roleplay scripts, PotatoHead? Link to comment
PotatoHead Posted July 20, 2013 Author Share Posted July 20, 2013 Which are you using roleplay scripts, PotatoHead? I got one from a friend. I am not quite sure what it is. I think its just a lot mixed together. He sold it to me for 5 dollars CAD. 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