🪑 Furniture As Items
Requirements
- ox_inventory - Furniture items are created and consumed through ox_inventory.
Configuration
Ensure the furniture command and permissions are enabled in your config.lua:
luaConfig = { -- Job permissions RealEstateJobs = { ["realestate"] = { ["give_furniture"] = 1, -- Can give furniture items }, }, -- Command name (default) GiveFurnitureCommand = "givefurniture", -- Default weight if the furniture has no weight defined DefaultFurnitureWeight = 1000, }
Adding the Furniture Item to ox_inventory
Add the following item to your ox_inventory/data/items.lua:
lua['furniture'] = { label = 'Furniture', weight = 0, stack = false, close = true, description = 'A piece of furniture from the property', consume = 0, client = { export = 'nolag_properties.UseFurniture', }, },
Give Furniture Command
Use the command to give a furniture item to a player:
/givefurniture [playerId|me] [furnitureName]
Example:
/givefurniture me apa_mp_h_stn_sofacorn_01
Only players with the give_furniture permission (configured in Config.RealEstateJobs) can use this command.
Furniture Names
The furnitureName argument must match a furniture object in furniture.lua under FurnitureConfig.Furniture.
Example entries:
luaFurnitureConfig.Furniture = { sofas = { items = { { object = 'apa_mp_h_stn_sofacorn_01', label = 'STN Sofacorn', price = 1450 }, { object = 'apa_mp_h_stn_sofa2seat_02', label = 'Sofa 2 Seat', price = 980 }, } } }
If a model does not exist in that list, the command will return "Furniture not found".
Using the Item
When the player uses the furniture item in ox_inventory, the nolag_properties.UseFurniture export is called:
- If the player is inside a property, the furniture placement starts immediately.
- If the player is in a yard zone shared by multiple properties, a context menu appears to choose the property.
- If the player is not in a property or yard zone, they will receive an error notification.
Exports
Server exports for integrations:
lua-- Give a furniture item to a player (adds to ox_inventory) local success = exports.nolag_properties:GiveFurnitureToPlayer(playerId, furnitureName)