Developer
Overview
ML PropsCarry provides client exports for reading and managing carried props, server exports for position data, and handler hooks in the open/ folder for custom logic. Props sync to other players via StateBags. Admins manage the live item catalog in-game with /carryadmin; changes persist to oxmysql and reach every player without a restart.
Server Exports
lua
1local positions = exports.ml_propscarry:GetPlayerPositions(source)GetPlayerPositions(source): Returns all custom positions for a player:{ itemName = {x, y, z, rx, ry, rz}, ... }
Client Exports
Prop State
lua
1local props = exports.ml_propscarry:GetCarriedProps()
2local positions = exports.ml_propscarry:GetCustomPositions()
3local otherProps = exports.ml_propscarry:GetOtherPlayersProps()GetCarriedProps(): Returns{ itemName = propEntity, ... }for the local playerGetCustomPositions(): Returns{ itemName = {x, y, z, rx, ry, rz}, ... }for the local playerGetOtherPlayersProps(): Returns{ serverId = { itemName = propEntity, ... }, ... }for nearby players
Prop Management
lua
1exports.ml_propscarry:AddCarriedProp(itemName, propEntity)
2exports.ml_propscarry:RemoveCarriedProp(itemName)
3exports.ml_propscarry:RefreshProps()
4exports.ml_propscarry:ForceBroadcast()AddCarriedProp(itemName, prop): Registers a prop entity as carriedRemoveCarriedProp(itemName): Removes a carried prop. Returns the entity handleRefreshProps(): Deletes all props and recreates them (full reset)ForceBroadcast(): Forces a StateBag update to sync with other players
Weapon Entity
lua
1local entity, hadComponents = exports.ml_propscarry:CreateWeaponEntity(itemConfig)CreateWeaponEntity(itemConfig): Creates a weapon object for aConfig.Itemsentry, with components and tint resolved from inventory metadata. Returns the entity and whether any components/tint were applied
Client Handlers
Located in open/client.lua.
open/client.lua
1function Handlers.CanShowProp(itemConfig)
2 return true -- return false to prevent spawning
3end
4
5function Handlers.OnPropSpawned(itemName, entity)
6end
7
8function Handlers.OnPropRemoved(itemName)
9end
10
11function Handlers.CanUseEditor(itemName)
12 return true -- return false to block editor
13endCanShowProp: Gate prop visibility. Returnfalseto hide (e.g. while cuffed or in a vehicle).OnPropSpawned: Fires after a prop is created and attached to the player.OnPropRemoved: Fires after a prop is deleted.CanUseEditor: Gate editor access per item.
Server Handlers
Located in open/server.lua.
open/server.lua
1function Handlers.CanSavePosition(src, itemName, position)
2 return true -- return false to block save
3end
4
5function Handlers.OnPositionSaved(src, itemName, position)
6end
7
8function Handlers.IsAdmin(src)
9 return nil -- return true/false to override, nil for default
10endCanSavePosition: Validate position before saving to KVP. Returnfalseto reject.OnPositionSaved: Fires after a position is saved.IsAdmin: Override the admin check used by/carryadminand the live catalog callbacks. Returnnilfor default (Bridge.HasPermission, then ACEml_propscarry.admin/admin).
Examples
open/client.lua
1function Handlers.CanShowProp(itemConfig)
2 if LocalPlayer.state.isCuffed then
3 return false
4 end
5 return true
6endyour_script/client.lua
1local carried = exports.ml_propscarry:GetCarriedProps()
2for itemName, entity in pairs(carried) do
3 print(itemName .. ' is visible on player')
4end