xSet Posted March 30, 2018 Posted March 30, 2018 Any good scripter that can help with making a autoopenning gate?
Moderators Patrick Posted March 30, 2018 Moderators Posted March 30, 2018 What is the "autoopenning gate"?
LLCoolJ Posted March 30, 2018 Posted March 30, 2018 (edited) --Functions createObject moveObject createColCuboid Events:https://wiki.multitheftauto.com/wiki/OnColShapeHithttps://wiki.multitheftauto.com/wiki/OnColShapeLeave Functions and events that will help you to make it Edited March 30, 2018 by IRBIS
Moderators Patrick Posted March 30, 2018 Moderators Posted March 30, 2018 (edited) settings = { objectID = GATEOBJECTID, -- fill up data closedPos = {x,z,y, rx,rz,ry}, -- fill up datas openedPos = {x,z,y, rx,rz,ry}, -- fill up datas duration = 2000, -- 2 sec (moving 2 sec) openedDuration = 5000, -- 5 sec (close after 5 sec) openRadius = 5, openInfo = "gate opened", closeInfo = "gate closed", opened = false, -- dont edit this } settings.gateObject = createObject(settings.objectID, settings.closedPos[1],settings.closedPos[2],settings.closedPos[3],settings.closedPos[4],settings.closedPos[5],settings.closedPos[6]) settings.openCol = createColSphere(settings.closedPos[1],settings.closedPos[2],settings.closedPos[3],settings.openRadius) function gate() if not settings.opened then moveObject(settings.gateObject, settings.duration, settings.openedPos[1],settings.openedPos[2],settings.openedPos[3],settings.openedPos[4],settings.openedPos[5],settings.openedPos[6]) outputChatBox(settings.openInfo, getRootElement()) else moveObject(settings.gateObject, settings.duration, settings.closedPos[1],settings.closedPos[2],settings.closedPos[3],settings.closedPos[4],settings.closedPos[5],settings.closedPos[6]) outputChatBox(settings.closeInfo, getRootElement()) end settings.opened = not settings.opened end addEventHandler("onColShapeHit", settings.openCol, function() if not settings.opened then gate() setTimer(gate, settings.openedDuration, 1) end end) Edited March 30, 2018 by gpetersz 1
#~DeV~# Posted April 1, 2018 Posted April 1, 2018 (edited) Quote Any good scripter that can help with making a autoopenning gate? local time = 4000 -- time for the gate open and close local gate = createObject(0, 0, 0, 0, 0, 0, 0) --(object id, x, y, z, rx, ry, rz) local marker = createMarker(0, 0, 0, "cylinder", 13, 255, 0, 0, 0) --(x, y, z, function moveGate(hitPlayer, matchingDimension) moveObject(gate, time, 0, 0, 0, 0, 0, 0) --(position when the gate is open (gate, time, x, y, z, rx, ry, rz) end addEventHandler("onMarkerHit", marker, moveGate) function moveBack() moveObject(gate, time, 0, 0, 0, 0, 0, 0) --(position when the gate is close same of "local gate = createObject..." but just(x, y, z, rx, ry, rz) not put id end addEventHandler("onMarkerLeave", marker, moveBack) -- for work with commands put addCommandHandler("open", moveGate) and addCommandHandler("close", moveBack) You need create a files with meta.xml and gate.lua, and put in meta.xml <script src="gates.lua" type="server"></script> Edited April 1, 2018 by ~DeV~ 1
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