Developer
Overview
ML LootProps exposes server exports for reading prop and category data, and handler hooks in the open/ folder for integration with other resources. Handlers return default values, override only the ones you need.
Server Exports
your_script/server.lua
1local config = exports['ml_lootprops']:GetPropConfig(propHash)
2local category = exports['ml_lootprops']:GetCategory('animals')
3local allProps = exports['ml_lootprops']:GetAllProps()
4local allCats = exports['ml_lootprops']:GetAllCategories()GetPropConfig(propHash): Returns the prop's config table, ornilGetCategory(categoryId): Returns a category config, ornilGetAllProps(): Array of{ hash, model }for all configured propsGetAllCategories(): Array of{ id, label }for all categories
Server Handlers
Defined in open/handlers_server.lua.
Loot Flow
open/handlers_server.lua
1Handlers.OnBeforeClaim = function(source, propHash, coords, config)
2 return true -- return false to block
3end
4
5Handlers.OnAfterClaim = function(source, propHash, coords, items, config)
6end
7
8Handlers.ModifyLoot = function(source, propHash, fixedLoots, probabilityLoots, config)
9 return fixedLoots, probabilityLoots
10end
11
12Handlers.GetLootMultiplier = function(source, propHash, config)
13 return 1.0 -- 2.0 = double loot
14end
15
16Handlers.GetBonusLoot = function(source, propHash, config)
17 return nil -- return { {name='item', amount=1} } for extra items
18endOnBeforeClaim: Called before loot is given. Returnfalseto block the claim.OnAfterClaim: Called after items are distributed.ModifyLoot: Intercept and modify the loot tables before they roll.GetLootMultiplier: Multiply item amounts.2.0= double loot.GetBonusLoot: Return extra items to add on top of the normal loot.
Cooldowns
open/handlers_server.lua
1Handlers.GetCooldownOverride = function(source, propHash, baseCooldown, config)
2 return nil -- return seconds to override
3end
4
5Handlers.CanBypassCooldown = function(source, propHash)
6 return false -- true = skip cooldown
7endGetCooldownOverride: Override the personal cooldown. Return seconds, ornilfor the configured value.CanBypassCooldown: Returntrueto let the player skip the cooldown.
Access Control
open/handlers_server.lua
1Handlers.CanPlayerLoot = function(source, propHash, config)
2 return true, nil -- false, 'reason' to block
3end
4
5Handlers.CanPlayerLootInArea = function(source, coords)
6 return true, nil
7endCanPlayerLoot: Gate access to a prop. Returnfalseand a reason string to block.CanPlayerLootInArea: Gate access by coordinates, for territory checks.
Dispatch
open/handlers_server.lua
1Handlers.ShouldTriggerDispatch = function(source, propHash, config)
2 return nil -- true/false to override, nil for default
3endShouldTriggerDispatch: Override the dispatch trigger.niluses the default chance.
Client Handlers
Defined in open/handlers_client.lua.
Interaction
open/handlers_client.lua
1Handlers.CanInteractWithProp = function(propHash, entity, coords)
2 return true -- false hides the target
3end
4
5Handlers.GetCustomTargetLabel = function(propHash, entity, config)
6 return nil -- string to override the label
7end
8
9Handlers.GetCustomTargetIcon = function(propHash, entity, config)
10 return nil -- e.g. 'fas fa-skull'
11end
12
13Handlers.GetCustomTargetDistance = function(propHash, entity, config)
14 return nil -- number to override the interaction distance
15end
16
17Handlers.AddCustomTargetOptions = function(propHash, entity, config)
18 return {} -- extra target menu options
19endCanInteractWithProp: Returnfalseto hide the target option on a prop.GetCustomTargetLabel: Override the target label.nilkeeps the default.GetCustomTargetIcon: Override the target icon.nilkeeps the default.GetCustomTargetDistance: Override the interaction distance for a prop.AddCustomTargetOptions: Add extra options to the prop's target menu.
Loot Lifecycle
open/handlers_client.lua
1Handlers.CanLootProp = function(propHash, entity, config)
2 return true, nil
3end
4
5Handlers.OnBeforeLoot = function(propHash, entity, config)
6end
7
8Handlers.OnAfterProgress = function(propHash, entity, config)
9 return true -- false cancels the claim
10end
11
12Handlers.OnLootFailed = function(propHash, entity, reason)
13endCanLootProp: Gate looting after interaction. Returnfalseand a reason to block.OnBeforeLoot: Fires before the loot progress bar starts.OnAfterProgress: Fires after the progress bar completes. Returnfalseto cancel.OnLootFailed: Fires when a loot attempt fails, such as a failed minigame.
Prop Tracking
open/handlers_client.lua
1Handlers.OnPropDetected = function(entity, propHash, coords)
2end
3
4Handlers.OnPropLost = function(entity, propHash)
5endOnPropDetected: Fires when the scanner registers a configured prop in range.OnPropLost: Fires when a tracked prop leaves range.
Examples
open/handlers_server.lua
1Handlers.GetLootMultiplier = function(source, propHash, config)
2 local day = os.date('*t').wday
3 if day == 1 or day == 7 then return 2.0 end
4 return 1.0
5endopen/handlers_server.lua
1Handlers.CanBypassCooldown = function(source, propHash)
2 local job = Bridge.GetJob(source)
3 return job and job.name == 'vip'
4endopen/handlers_server.lua
1local eventActive = false
2
3Handlers.CanPlayerLoot = function(source, propHash, config)
4 if eventActive then
5 return false, 'Looting disabled during events'
6 end
7 return true
8end