mdx_gates

mdx_gates

This item is free.

Add to Basket
# MDX Gates

**Animated gates, hangar doors and garage doors for your FiveM emergency-service bases.**
Give your HEMS base, police compound or fire station doors that move with purpose. MDX Gates combines custom animated models, a touch-panel-style interface and server-managed door states in one configurable resource.
## Custom animated doors
- Included HEMS hangar and RRV garage doors, police gates, fire-service gates and fire-station bay doors.
- Skeletal animations with matching animated collision.
- Adjustable movement timing and speed globally, per door type or per gate.
- Add more compatible models and animation types through the config.
## Clear, practical controls
- Control individual doors, named groups or every door assigned to a panel.
- Live Open, Closed, Opening and Closing indicators, plus obstruction warnings.
- At-a-glance counts of open doors and doors in motion.
- Configure multiple interaction panels, each controlling its own selection of doors.
- Walk-up interaction through ox_target, with E-key fallback for doors and panels.
## Shared state across the server
- Server-managed transitions with job, distance and panel-membership checks.
- Automatic state sync when players join or respawn, including doors already moving.
- Optional global and per-gate auto-close timers that start once opening finishes.
- Configurable doorway checks that delay closure when a detected vehicle or player is in the way.
## Station turnout and immersion
- A configurable turnout button opens selected bays, plays the station alarm and activates bay lighting.
- Place multiple alarm speakers with directional audio and distance-based volume falloff.
- Configure opening and closing sounds by door type or individual gate.
- Fire-pole slide interactions through ox_target.
- Server exports let dispatch and pager resources start or stop a turnout.
- Built-in `/gatezone` placement tool copies ready-to-paste interaction-zone settings.
## Framework support
Standalone, QBCore, QBox, ESX / ESX Legacy and TMC, with optional framework-based job restrictions.
## Requirements
- FiveM server with OneSync enabled.
- ox_lib.
- ox_target is optional for doors and panels; required for fire-pole interactions.
- Your chosen framework if job restrictions are enabled.
## Included
- Custom streamed door models, textures, animations and collision-expression files.
- Editable, commented `config.lua`.
- Self-contained HTML, CSS, JavaScript and included audio, with no CDN dependencies.
- Setup and integration instructions.
**Resource name: `mdx_gates`**
*Set your locations, choose your access rules and put your base doors to work.*
Base buildings, maps and a physical wall-panel model are not included. The control interface opens from configurable world interaction points.
README.md
# MDX Gates (`mdx_gates`)
Animated emergency-service gates, hangar doors and garage doors with local streamed props and authoritative server state.
## Installation
1. Place this folder in your server resources as `mdx_gates`.
2. Enable OneSync and start `ox_lib` before this resource.
3. Start `ox_target` first if you use it. Without it, doors and panels use E-key prompts. Fire poles require ox_target.
4. Set `Config.Framework` and `Config.AllowedJobs`. Standalone permits all players; framework modes enforce the whitelist on the server.
5. Review your existing door, panel, obstruction, speaker and light locations in `config.lua`. Several original locations are marked as placeholders.
6. Add `ensure mdx_gates` to server.cfg, or ensure the parent resource category. This installation already uses `ensure [main]`.
Restart the server after migrating from the old resource name so previously running client scripts and props are cleaned up. Do not run both resource versions together.
## Configuration
Your original gate IDs, positions, rotations, assets and panel memberships are retained. Internal model and animation names remain unchanged because the streamed assets reference them.
- `Config.AnimDuration`: base traversal time at speed 1.0, in seconds (default 5).
- `Config.AnimSpeed`: default speed multiplier; 0.5 doubles the traversal time.
- Animation types can override `duration`, `openDuration`, `closeDuration` and `speed`. Gates can override `duration` and `speed`.
- Movement time is base duration divided by speed. Unlike the previous script, timing comes from this shared configuration rather than client-only clip lengths. Tune it in game for your preferred motion.
- `Config.AutoCloseDelay`: seconds after opening completes; 0 disables it. Per-gate `autoClose = false` disables auto-close; `autoCloseDelay` overrides the global delay.
- `Config.Obstruction`: doorway dimensions and auto-close retry interval. Tune these boxes for each door's actual model origin.
- `openSound` / `closeSound`: gate overrides animation type, which overrides the global sound. Use false for silence. Included files are `alarm.ogg` and `gate.ogg`.
- `Config.InteractionTolerance`: server-side allowance around target-zone bounds.
- `Config.AssetLoadTimeout`: prevents missing door assets from blocking all later spawns.
- `Config.DevMode`: enables `/gatezone`; disable it after placement.
The UI is a screen overlay opened from world interaction points. It does not spawn a wall-panel prop. Door collision uses the included skeletal assets and expression dictionaries.
## Dispatch integrations
Call from trusted server scripts:
```lua
exports.mdx_gates:Turnout("davis_firestation_main")
exports.mdx_gates:StopTurnout("davis_firestation_main")
-- Alternative server-only event:
TriggerEvent("mdx_gates:triggerTurnout", "davis_firestation_main")
```
Exports return true when the requested turnout operation was applied and false for an unknown, unavailable or already matching turnout. Starting a turnout opens eligible closed doors; doors already moving finish their current movement. Stopping turnout stops its sound and lights, leaving door positions unchanged.
Network events use the `mdx_gates:` namespace. Door requests contain a gate ID, destination (`open` or `closed`) and optional panel ID. The server verifies access, proximity, membership and current movement before accepting them. Update external integrations that used the old resource/event names.
## Behaviour and limits
- Doors reject reversal requests while moving. Duplicate requests do not restart animations.
- Auto-close waits when the doorway is obstructed and retries later.
- Obstruction checks run before closure; they are not continuous anti-crush detection. Server checks use networked vehicle/player origin points; local manual checks also cover nearby NPCs. Tune dimensions accordingly.
- Joining and respawning players receive current movement progress and active turnout state. Network latency can cause small visual timing differences.
- Door state is held in server memory and resets to closed on resource/server restart.
- Start dependencies before this resource. Restart mdx_gates after changing ox_target availability.
- Framework integration requires matching framework exports; missing or unsupported frameworks deny access.
- Test animation, collision, audio, lights and placement in FiveM before release.