> For the complete documentation index, see [llms.txt](https://hane-mod-studio.gitbook.io/hane-mod-studio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hane-mod-studio.gitbook.io/hane-mod-studio/hane-scripts/hane-motel/bridge-system.md).

# Bridge System

The Hane Motel Script uses a **bridge architecture** to remain compatible with multiple frameworks, inventory systems, target systems, and appearance systems.\
Thanks to this structure, the core script remains independent of the server’s underlying infrastructure.\
The bridge system centralizes all framework and third-party integrations into a single layer.

***

### Purpose of the Bridge System

The main goals of the bridge architecture are:

* Framework-independent operation
* Abstracting inventory, target, and appearance systems
* Eliminating the need for framework-specific code in the core script
* Supporting different server infrastructures with minimal setup differences

The core script does not directly call any framework or inventory functions.\
All operations are handled through the bridge files.

***

### loader.lua – Bridge Loader

File: `loader.lua`

`loader.lua` is the core of the bridge system.\
It loads the correct bridge files based on the settings defined in the config file.

#### How It Works

* Reads `Config.Framework`
* Reads `Config.Inventory`
* Reads `Config.Target`
* Reads `Config.Appearance`
* Loads the corresponding Lua files at runtime

This approach ensures that:

* Unused bridge files are not executed
* Invalid combinations are prevented
* Script performance is preserved

***

### Framework Bridge Files

Framework bridge files standardize player data handling, money transactions, and general framework functions.

#### Supported Framework Bridges

* `qbx.lua`
* `qb.lua`
* `esx.lua`
* `ndcore.lua`
* `oxcore.lua`
* `standalone.lua`

#### Responsibilities of Framework Bridges

These files handle the following:

* Retrieving player data according to the active framework
* Managing money checks and payment transactions
* Normalizing player identifiers and character data
* Providing a common API for the core script

No framework checks are performed inside the core script.\
All framework-related operations are executed through bridge functions.

***

### Inventory Bridge Files

Inventory bridges adapt key and item operations to the active inventory system.

#### Supported Inventory Bridges

* `ox.lua` → ox\_inventory
* `qb.lua` → qb-inventory
* `qs.lua` → qs-inventory

#### Responsibilities of Inventory Bridges

* Giving keys to players
* Removing keys from players
* Checking whether a player owns a key
* Abstracting inventory-specific API differences

This ensures the core script contains no inventory-specific logic.

***

### Target Bridge Files

Target bridges define how players interact with doors and interaction points.

#### Supported Target Bridges

* `ox.lua` → ox\_target
* `qb.lua` → qb-target
* `qtarget.lua`
* `interact.lua`

#### Responsibilities of Target Bridges

* Defining interaction zones
* Adding target options
* Handling framework- or target-specific callbacks

If an incorrect or inactive target system is selected, interactions will not function.

***

### Appearance Bridge Files

Appearance bridges manage player appearance-related operations.

#### Supported Appearance Bridges

* `fivem.lua`
* `illenium.lua`
* `rcore.lua`

#### Responsibilities of Appearance Bridges

* Handling room-related appearance logic
* Abstracting API differences between appearance systems

***

### Advantages of the Bridge System

This architecture provides several key benefits:

* A single script supports multiple server infrastructures
* Changing the framework does not affect the core script
* Adding new frameworks or inventory systems becomes easier
* Improved code readability and maintainability

To add a new system, only a corresponding bridge file needs to be implemented.

***

### Important Notes

* The systems selected in the config file must match the available bridge files
* Incorrect combinations may cause the script to fail
* All loading operations are handled exclusively by `loader.lua`

***

### Summary

The bridge system makes the Hane Motel Script’s core **framework-independent**.\
All integrations are consolidated into a single layer, keeping the core script clean and maintainable.\
This architecture is the most critical component that ensures the script runs reliably across different servers.
