# Configuration > Configuration reference for ML Trap Category: TRAP · Source: https://miciomods.it/docs/ml-trap-configuration · Last updated: 2026-07-17 ## Overview - `shared/config.lua`: Gameplay, interaction, streaming, durability, limits and the full trap/bait catalog. - `server/config_server.lua`: Discord log webhook and provider. Trap, bait and repair items are referenced by their inventory item name, so any key changed here must match an item registered in the inventory. ## General **shared/config.lua** ```lua Config.Debug = false Config.locale = 'en' Config.InteractionMethod = 'target' Config.UITheme = 'default' ``` - `Debug`: Prints internal state to the console. Leave `false` in production. - `locale`: Language code for translations. Files live in `locales/`. - `InteractionMethod`: `'target'` attaches the option to the prop, `'textui'` uses a key press near the trap. - `UITheme`: Panel and in-world tag theme. One of `'default'`, `'wasteland'`, `'cyberpunk'`, `'noir'`, `'fantasy'`. ## Notifications **shared/config.lua** ```lua Config.Notifications = { onCapture = false, onSelfCaptured = true, onKill = true, onCageOpened = true, } ``` - `onCapture`: Popup for bystanders when an animal is captured. - `onSelfCaptured`: Popup for a player trapped inside a cage. - `onKill`: Popup for the player who killed the captive. - `onCageOpened`: Popup when a cage is opened. ## In-World Tag **shared/config.lua** ```lua Config.DUI = { enabled = true, maxActive = 8, distance = 18.0, offsetZ = 1.2, offsetX = 0.0, offsetY = 0.0, scale = 1.0, } ``` - `enabled`: Master toggle for the floating tag above each trap. - `maxActive`: Maximum number of tags rendered at once. The nearest traps win the slots. - `distance`: Render distance in meters. The tag fades out near the edge. - `offsetZ` / `offsetX` / `offsetY`: Default tag position relative to the trap origin. Overridden per type in `Config.TrapTypes[...].dui`. - `scale`: Master size multiplier, applied on top of any per-type `dui.scale`. ## Distances **shared/config.lua** ```lua Config.MaxPlacementDistance = 20.0 Config.MaxInteractionDistance = 5.0 ``` - `MaxPlacementDistance`: Maximum distance from the player a trap may be placed. Enforced on the server. - `MaxInteractionDistance`: Maximum distance to bait, repair, open, kill or pick up a trap. Enforced on the server. ## Capture Rules **shared/config.lua** ```lua Config.CageCatchAll = true Config.OwnerOnlyPickup = true Config.OwnerOnlyCage = true Config.AllowPlayerCapture = false Config.MaxPlayerCaptureSeconds = 120 ``` - `CageCatchAll`: `true` lets a cage capture any animal or NPC that enters the radius. `false` restricts it to the peds listed by the loaded bait. Players are never caught this way, that is what `AllowPlayerCapture` controls. - `OwnerOnlyPickup`: Only the trap owner or an admin can pick up a trap. Set `false` to let anyone pick it up. - `OwnerOnlyCage`: Only the owner or an admin can open a cage or kill the captive. Set `false` to allow anyone. - `AllowPlayerCapture`: Master switch for player capture. Off by default. When on, a cage type flagged `capturesPlayers` springs shut on a non-owner player who steps into it while baited, and the owner or an admin can close it on a player standing in the radius. The captive cannot open the cage or pick it up. - `MaxPlayerCaptureSeconds`: A captured player is auto-released after this many seconds. Only relevant when `AllowPlayerCapture` is on. ## Kill Weapons **shared/config.lua** ```lua Config.KillWeapons = { `WEAPON_KNIFE`, `WEAPON_MACHETE`, `WEAPON_HATCHET`, `WEAPON_SWITCHBLADE`, `WEAPON_BATTLEAXE`, `WEAPON_STONE_HATCHET`, `WEAPON_DAGGER`, } ``` - `KillWeapons`: Weapon hashes allowed to kill a captured animal. The server checks the held weapon against this list. ## Kill Loot **shared/config.lua** ```lua Config.KillLoot = { enabled = false, animals = { ['a_c_boar'] = { { item = 'meat', min = 2, max = 4, chance = 100 }, { item = 'hide', min = 1, max = 1, chance = 50 }, }, ['a_c_hen'] = { { item = 'white_meat', min = 1, max = 2, chance = 100 }, { item = 'feather', min = 1, max = 3, chance = 80 }, }, }, } ``` - `enabled`: Hands loot to the killer when a captured animal is put down. Off by default, so rewards stay with the `open/server.lua` hooks. - `animals`: Loot lists keyed by ped model. The shipped config carries an example entry for every animal in the default bait lists. - Each entry rolls on its own: `chance` is a percent roll, then an amount between `min` and `max` is given. - `item`: Must be registered in the inventory. A full inventory drops the overflow on the ground; an unregistered item name gives nothing and prints an error in the server console. ## Streaming **shared/config.lua** ```lua Config.Streaming = { distance = 150.0, loopActiveMs = 500, loopIdleMs = 3000, } ``` - `distance`: Trap props spawn and despawn around the player within this radius. Trap data stays in memory at all times. - `loopActiveMs`: Capture and attraction loop interval while baited traps are visible. - `loopIdleMs`: Loop interval while no baited traps are visible. ## Ambient Wildlife **shared/config.lua** ```lua Config.AmbientSpawn = { enabled = false, spawnDistance = 60.0, intervalSec = 90, chance = 100, } ``` - `enabled`: Wildlife spawner for servers with no native animal population. When a baited trap has no live animal to attract, the server spawns one synced animal in the distance and it wanders in like a native one. Leave off when wildlife already roams the map. - `spawnDistance`: Meters from the trap where the animal appears. Capped to the bait's attraction radius. - `intervalSec`: Minimum seconds between spawns per trap. - `chance`: Percent chance that an allowed attempt actually spawns an animal. Spawned animals count toward the same rule as native ones: a trap lures a single animal at a time. Baits with NPC lists are not covered by the spawner. ## Persistence **shared/config.lua** ```lua Config.Persistence = { enabled = true, } ``` - `enabled`: Master toggle for the database. Set `false` to keep every trap in memory only, cleared on restart. ## Cleanup **shared/config.lua** ```lua Config.Cleanup = { enabled = true, inactiveDays = 7, checkIntervalMin = 60, deleteOnlyIfBroken = false, } ``` - `enabled`: Auto-deletes persistent traps that have not been used in a while. - `inactiveDays`: A trap idle for this many days is removed. - `checkIntervalMin`: How often the cleanup pass runs, in minutes. - `deleteOnlyIfBroken`: `true` limits cleanup to traps with no durability left. ## Durability **shared/config.lua** ```lua Config.Durability = { tickIntervalMs = 5000, } ``` - `tickIntervalMs`: Server tick that drains durability while a trap is baited or holding a capture. ## Limits **shared/config.lua** ```lua Config.Limits = { maxTotalPerPlayer = 10, maxPerType = { ['snap_trap'] = 5, ['cage_trap_small'] = 3, ['cage_trap_large'] = 2, }, } ``` - `maxTotalPerPlayer`: Total traps a single player can own. - `maxPerType`: Per-trap-type cap, keyed by the trap item name. ## Trap Types `Config.TrapTypes` is keyed by the trap item name. Each entry defines the prop set, the baits it accepts, and optional wear and tag overrides. **shared/config.lua** ```lua ['snap_trap'] = { label = 'Snap Trap', trapStyle = 'snap', persistent = true, prop_unbaited = 'dgm_baitbuild', eatDistance = 1.5, dui = { offsetX = 0.0, offsetY = 0.0, offsetZ = 0.45, scale = 0.85 }, durability = 4, RepairItems = { ['rope'] = { required = 1, repair = 50 }, ['wood'] = { required = 2, repair = 25 }, }, baits = { ['meat_bait'] = { label = 'Meat Bait', prop_baited = 'dgm_bait_meat1', duration = 10, distance = 100, trapType = 'animal', animals = { 'a_c_mtlion', 'a_c_coyote', 'a_c_boar' }, baitOffset = { x = 0.0, y = 0.0, z = -0.15 }, }, }, } ``` - `label`: Display name in the panel. - `trapStyle`: `'snap'` is a flat walk-on trap; the loaded bait prop rests on top of the body. `'cage'` is a live trap with an animated door. - `persistent`: `true` saves the trap to the database and survives restarts. - `prop_unbaited`: Trap body model. It stays the same whether the trap is baited or not. - `eatDistance`: Snap traps only. An animal starts eating once it is within this many meters of the bait. Lower keeps it tight to the trap; set it too low and large animals cannot reach the center. - `durability`: Hours of active use before the trap breaks. Omit the field to make the trap last forever and hide the repair tab. - `RepairItems`: Materials that restore durability. `required` is the amount consumed, `repair` is the percent restored. - `dui`: Per-type tag override. Falls back to `Config.DUI` when omitted. - `baits`: Items the trap accepts, keyed by the bait item name. ### Bait fields - `label`: Display name in the panel. - `prop_baited`: Prop shown when this bait is loaded. It sits on top of a snap trap or inside a cage. - `duration`: Minutes the bait stays active. `0` never expires, typical for cages. - `distance`: Attraction radius in meters. The nearest matching animal in this range walks toward the trap; a trap lures one animal at a time. - `trapType`: `'animal'` or `'npc'`, selecting which ped list is used. - `animals` / `npcs`: Ped models this bait attracts and can capture. - `baitOffset`: Local offset (x, y, z) along the trap's own axes, so the bait follows the trap tilt on sloped ground. Optional rotX, rotY and rotZ add pitch, roll and yaw. Set it to rest the bait on the trap instead of the world ground. ### Cage fields Cage types add door and capture fields alongside the snap fields. **shared/config.lua** ```lua ['cage_trap_small'] = { label = 'Small Cage Trap', trapStyle = 'cage', persistent = true, prop_unbaited = 'pxl_modding_muma_strap', prop_body = 'pxl_modding_muma_strap', prop_door = 'pxl_modding_muma_strap_d', doorZOffset = 1.08324, captureRadius = 0.8, groundZOffset = -0.05, doorCloseTime = 800, doorOpenTime = 1600, } ``` - `prop_body`: Permanent cage structure. - `prop_door`: Animated door model. - `doorZOffset`: Height the door travels when it opens. - `captureRadius`: Distance from the cage center a ped is caught. - `groundZOffset`: Vertical nudge applied after the cage is seated on the ground. The cage models sit a few centimeters high, so a small negative value settles them; lower it to sink the cage further. - `doorCloseTime` / `doorOpenTime`: Door animation duration in milliseconds. - `capturesPlayers`: Set `capturesPlayers = true` on a cage type to let it trap players when `Config.AllowPlayerCapture` is on. The shipped Large Cage has it; omit the field for animal-only cages. ## Logging **server/config_server.lua** ```lua Config.LogWebhook = '' Config.LogProvider = 'discord' ``` - `LogWebhook`: Discord webhook for place, pickup, kill and steal-attempt logs. - `LogProvider`: `'discord'`, `'fivemanage'`, `'ox_lib'`, `'both'` or `'all'`. Set the webhook to `''` to disable that log entirely.