MTA Anti-Cheat Team Popular Post Dutchman101 Posted November 19, 2017 MTA Anti-Cheat Team Popular Post Share Posted November 19, 2017 Download: https://community.multitheftauto.com/?p=resources&s=details&id=14987 This resource enables you to create gates at specified locations, that will open when you arrive infront of them. It's a simple resource, the reason for still releasing it and creating a topic is because it's a very commonly sought type of script, this can be a proper reference for those in need of it. If you want to quickly grab the code instead of the ready resource; local gates = { { model = 985, -- Gate object ID so you can change type of gate originalPosition = Vector3(-1698.5302734375, 1392.7216796875, 7.1786022186279), -- Example gate is located at SF Well stacked pizza & Co, near sea originalRotation = Vector3(0,0,130.67932128906), newPosition = Vector3(-1704.1123046875, 1398.6796875, 7.1786022186279), -- Edit depending on the opening width you want to cover with the gate, this defines how far it will move to the side (creating the gate's opening effect) open = false, movingInterval = 3000, --Move time in milliseconds colInfo = {createColSphere,{-1698.5302734375, 1392.7216796875, 7.1786022186279,7.5}}, }, -- If you need to add more gates, you can simply copy the above chunk and duplicate it within the 'local gates' table. } local colshapes = {} local function toggleGate(element) if element.type ~= "player" then return end if element.dimension ~= source.dimension then return end if element.interior ~= source.interior then return end local gate = gates[colshapes[source]] gate.open = eventName=="onColShapeHit" if gate.open then gate.object:move(gate.movingInterval,gate.newPosition,0,0,0) else gate.object:move(gate.movingInterval,gate.originalPosition,0,0,0) end end local function initScript() for gateIndex,gate in ipairs(gates) do gate.object = Object(gate.model,gate.originalPosition,gate.originalRotation) local func,args = unpack(gate.colInfo) gate.colshape = func(unpack(args)) colshapes[gate.colshape] = gateIndex addEventHandler("onColShapeHit",gate.colshape,toggleGate) addEventHandler("onColShapeLeave",gate.colshape,toggleGate) end end addEventHandler("onResourceStart",resourceRoot,initScript) 3 1 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