Installation

0Resmon Motels Installation Document and Basic Concepts

This installation guide covers both ESX and QBCore frameworks.

What is required for installation

  • 0r_lib (You can find it on your Keymaster.)

  • Map Files (You can find it script files)

Supported Inventories

  • qb-inventory

  • qs-inventory

  • ox_inventory

  • ps-inventory

  • lj-inventory

  • origen_inventory

  • ls-inventory

  • core-inventory

Apartment System Installation

Apartment system, when players register to the server, they automatically start the server in the hotel room. To achieve this, we need to make a few changes.

First, change Config.Apartment = true in the config.lua file.

Config.Apartment = true

esx_multicharacter Setup

Open the esx_multicharacter/client/main.lua file and then, as you see in the photo, you should leave a space after line 271 and place the triggerevent that allows giving a Random Room.

The code sample is available below the photo.

TriggerEvent('0R:Motels:Client:SetPlayerRandomRoom')

qb-multicharacter Setup

First you must disable qb-apartments.

What you need to do here is; Open the qb-multicharacter/client/main.lua file and find the qb-multicharacter:client:closeNUIdefault event starting at line 100. And update as below.

Code You Need to Add:

if not exports["0r_motels"]:GetApartment() then
    SetEntityCoords(PlayerPedId(), Config.DefaultSpawn.x, Config.DefaultSpawn.y, Config.DefaultSpawn.z)
end

What we need to do in the same way here is; Open the qb-multicharacter/server/main.lua file and find the qb-multicharacter:server:createCharacter event starting at line 116 and add the following code with a space after line 124.

if exports["0r_motels"]:GetApartment() then
    TriggerClientEvent('0R:Motels:Client:SetPlayerRandomRoom', src)
end

Using a different multi-character?

If you are using a different multi-character, you need to place the event in the server or client event where the player is registered to integrate it. I leave a small explanation.

You must add this code to the new section of the player's character. Each multicharacter has a default spawn point. You must cancel these spawn points.

if exports["0r_motels"]:GetApartment() then
    TriggerClientEvent('0R:Motels:Client:SetPlayerRandomRoom', src)
end

We have an export for this, exports["0r_motels"]:GetApartment(). Thanks to this export, you can check whether the Apartment system is active or not. If Config.Apartment is true, you must cancel the default spawn points of your multicharacter.

Setup for Ox Inventory

Open the ox_inventory/data/items.lua file. And place the following code.

['motelcard'] = {
	label = 'Motel Card',
	weight = 200,
	stack = false
},

['doorlockpick'] = {
	label = 'Lockpick',
	weight = 200,
	stack = false
},

and now open the ox_inventory/modules/items/client.lua file and place the following code.

Item('motelcard', function(data, slot)
    TriggerEvent('0R:Motels:Client:OpenDoorNotTeleport', slot)
end)

Setup for QS, LJ, Origen, PS, QB Inventories

The best thing about these inventories is that their infrastructure is qb-inventory. That's why the installations are the same.

Place these items in items.lua in your inventories. (qb-inventory to qb-core/shared/items.lua)

['motelcard'] = {['name'] = 'motelcard', ['label'] = 'Motel Card', ['weight'] = 500, ['type'] = 'item', ['image'] = 'motelcard.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Motel Card'},

Open your inventory javascript file. And search for the FormatItemInfo function and place this code in the if loop within that function. There should be a metadata.js file in qs-inventory, do the same process there.

} else if (itemData.name == "motelcard") {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html(
        "<p><strong>Motel: </strong><span>" +
        itemData.info.motelname +
        "</span></p><p><strong>Room Id: </strong><span>" +
        itemData.info.roomid
);

For New qb-inventory

case "motelcard":
    return `<p><strong>Motel: </strong><span>${itemData.info.motelname}</span></p>
    <p><strong>Room ID: </strong><span>${itemData.info.roomid}</span></p>`;

for codem-inventory (in metadata.js)

} else if (item.name.match("motelcard")) {
    let infoData = [
        { label: "Motel: ", value: iteminfo.motelname },
        { label: "Room ID:", value: iteminfo.roomid },
    ]
    returnString = infoData;

server.cfg

The server.cfg initialization order should be as follows.

If you are going to use an apartment system, pay attention to the server.cfg sequence. The motel system must be initialized before your multicharacter script.

ESX

start es_extended
start 0r_lib
start 0r_motels
--- esx resources --

QBCore

start qb-core
start 0r_lib
start 0r_motels
--- qbcore resources --

What You Need to Know


Where is the sql file ?

There is no SQL File. The system automatically installs SQL into your database.

How to add a motel room?

You can get information about this by watching this video.

https://youtu.be/Wx-91KYJmvQ

How to create a motel?

You can get information about this by watching this video.

https://youtu.be/_bO_Velqtpw

How to create new room type ?

Last updated