Property Integration
Property Integration
This is the most important section for server owners who want crafting in apartments/houses.
How Property Integration Works
The script uses the lvs_bridge events to sync workbenches placed inside properties:
Player enters property:
lvs_bridge:server:enterPropertyis triggeredScript loads property-specific workbenches from database
Player exits property:
lvs_bridge:server:exitPropertyis triggeredScript unloads property workbenches from client
Required Bridge Events
Your property system (apartments/houses) must trigger these events:
Server-Side Events
When a player enters a property:
TriggerEvent('lvs_bridge:server:enterProperty', playerId, propertyType, propertyId, extra)playerId(number): Player server ID (optional, defaults to source)propertyType(string):'house','apartment', etc.propertyId(string): Unique property identifierextra(any): Extra data (optional)
When a player exits a property:
playerId(number): Player server ID (optional, defaults to source)
Client-Side Events
The bridge also provides client events (usually auto-handled):
lvs_bridge:client:enterPropertylvs_bridge:client:exitProperty
Integration Steps
Locate your property script (apartments, housing, etc.)
Find where players enter/exit properties - typically:
After teleporting to interior
Before loading interior
On leaving/despawning interior
Add the event triggers:
Test the integration:
Enter a property
Place a workbench (if you have the item)
Exit and re-enter - workbench should persist
Another player entering same property should see the workbench
Example Integration with qb-apartments
If using qb-apartments, locate the enter/exit events:
_canPlaceWorkbench Function
_canPlaceWorkbench Functionserver/editable.lua Checks whether a player can currently place a crafting workbench at their current location.
Description
This function is executed when the server receives a request to place a crafting workbench. Its main purpose is to validate if the player meets the necessary requirements, specifically whether they are inside a property that allows placing workbenches.
The system retrieves the property data where the player is located using _getPlayerPropertyData(). If the player is not in a property, they cannot place the workbench.
Allows implementing custom logic to restrict certain types of workbenches based on property type. For example, preventing large crafting tables from being placed in small apartments.
Parameters
playerId
number
Server ID (source) of the player attempting to place the workbench
workbenchName
string
Name of the workbench item to be placed (e.g., 'lvs_crafting_table_large')
extra
table?
Additional information sent from the lvs_bridge:server:enterProperty trigger. May contain extra property data or additional context. Nil if no information was sent.
Returns
boolean
Returns true if the player can place the workbench, false otherwise
Return Values
true: Player is inside a property and meets all requirements to place the workbenchfalse: Either:Player is not inside any property, OR
Custom restrictions prevent placing this specific workbench type in the current property
Example Usage
Default Behavior
By default, the function allows placing any workbench if the player is inside a property:
Custom Restriction Example
Prevent placing large crafting tables in apartments:
Advanced Custom Logic
You can implement more complex restrictions:
Related Events
lvs_bridge:server:enterProperty: Event that sends property information including theextraparameter used in this function
Notes
The
extraparameter contains additional data that may have been sent when entering the propertyCustomize this function to implement your own server-specific restrictions
The function
Last updated