> 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/installation-guide.md).

# Installation Guide

This document explains the **mandatory installation steps** required for the Hane Motel Script to function properly.\
The script **will not run under any circumstances** unless the contents inside the `install/sql` and `install/code` directories are installed.

***

### Requirements

Before starting the installation, make sure the following dependencies are installed and running on your server:

* **oxmysql** (minimum v2.4.0)
* **ox\_lib** (minimum v3.14.0)
* **ox\_doorlock**

This script uses **ox\_doorlock** to handle door authorization for Pinkcage Motel rooms.

***

### 1. install/sql Installation

The `install/sql` directory creates the required **database tables and records** for motel rooms and doors.

#### 1.1 hane\_motel.sql

This SQL file performs the following actions:

* Creates the `hane_motel` table
* Inserts Pinkcage Motel rooms into the database
* Defines room rental prices and room IDs

**Installation Steps**

1. Open your database manager (HeidiSQL)
2. Select the database used by your server
3. Execute the `hane_motel.sql` file

**Post-Installation Check**

* The `hane_motel` table should be created
* Records with `motelId = pinkcage_motel` should be visible
* `rentPrice` values for rooms should be populated

***

#### 1.2 ox\_doorlock\_pinkcage.sql

This SQL file:

* Creates the `ox_doorlock` table if it does not already exist
* Adds all Pinkcage Motel room doors
* Uses `authCallback = hane_motel:hasRoomAccess` for door authorization

**Installation Steps**

1. Open your database manager
2. Select the database used by your server
3. Execute the `ox_doorlock_pinkcage.sql` file

**Post-Installation Check**

* Records such as `pinkcage_1`, `pinkcage_2` should appear in the `ox_doorlock` table
* The JSON data should contain the `authCallback` field

***

### 2. install/code – Inventory Installation

The Hane Motel Script is designed to work with multiple inventory systems.\
You must install **only the Lua file that matches the inventory system you are using**.

Installing the wrong inventory file will cause the motel key system to fail.

***

#### 2.1 ox\_inventory Installation

File: `ox_inventory_item.lua`

This file adds the motel room key to the **ox\_inventory** system.

**Installation Steps**

1. Open `ox_inventory/data/items.lua`
2. Copy the contents of `ox_inventory_item.lua`
3. Paste it directly into `items.lua`

***

#### 2.2 qb-inventory Installation

File: `qb-inventory_item.lua`

This file registers the motel key in the **qb-inventory** system.

**Installation Steps**

1. Open `qb-core/shared/items.lua`
2. Copy the contents of `qb-inventory_item.lua`
3. Add the item definition to an appropriate section

***

#### 2.3 qs-inventory Installation

File: `qs-inventory_item.lua`

This file adds the motel key to the **qs-inventory** system.

**Installation Steps**

1. Open `qs-inventory/config/items.lua`
2. Copy the contents of `qs-inventory_item.lua`
3. Add it to the appropriate section of the item list

***

### 2.4 ox\_doorlock Patch Installation

File: `ox_doorlock_patch.lua`

This patch is **mandatory** for ox\_doorlock to work correctly with the Hane Motel Script.

**Required Steps**

1. Make a backup of `ox_doorlock/server/main.lua`
2. Copy the contents of `ox_doorlock_patch.lua`
3. Replace the existing `main.lua` with the patched version

**Minimum Version Requirements**

* oxmysql: 2.4.0
* ox\_lib: 3.14.0

If this patch is not applied, the door authorization system will not function reliably.
