Installation

0Resmon Apartment 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

  • ox_inventory

ESX

start es_extended
start 0r_lib
start 0r_apartment
--- esx resources --

QBCore

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

QBCore QB-Apartment ?

  • Q: I want new players to choose an apartment and have a random room, what should I do?

  • A: First of all, you should be using qb-spawn and qb-multicharacter and qb-apartments for this. After this you won't need qb-apartments. However, it is your responsibility to make sure that other scripts that use it don't malfunction. The functions have been edited to replace qb-apartments. So if you use other scripts, you should fix them according to your settings. Here is what you need to do in order:

1- In qb-multicharacter: server/main.lua replace this code block:

RegisterNetEvent('qb-multicharacter:server:createCharacter', function(data)
    local src = source
    local newData = {}
    newData.cid = data.cid
    newData.charinfo = data
    if QBCore.Player.Login(src, false, newData) then
        repeat
            Wait(10)
        until hasDonePreloading[src]
        if GetResourceState('0r-apartment') == 'started' then -- > This place has changed !
            local randbucket = (GetPlayerPed(src) .. math.random(1,999))
            SetPlayerRoutingBucket(src, randbucket)
            print('^2[qb-core]^7 '..GetPlayerName(src)..' has successfully loaded!')
            QBCore.Commands.Refresh(src)
            loadHouseData(src)
            TriggerClientEvent("qb-multicharacter:client:closeNUI", src)
            TriggerClientEvent('apartments:client:setupSpawnUI', src, newData, true, true) -- > This place has changed !
            GiveStarterItems(src)
        else
            print('^2[qb-core]^7 '..GetPlayerName(src)..' has successfully loaded!')
            QBCore.Commands.Refresh(src)
            loadHouseData(src)
            TriggerClientEvent("qb-multicharacter:client:closeNUIdefault", src)
            GiveStarterItems(src)
        end
    end
end)

2- In qb-spawn/fxmanifest: replace shared_scripts with the following.

shared_scripts {
    '@qb-core/shared/locale.lua',
    'locales/en.lua',
    'locales/*.lua',
    'config.lua',
    --'@qb-apartments/config.lua',
    "@0r-apartment/shared/config.lua",
}

3- qb-spawn/client.lua

local Apartments = Config.Apartments -- You should add this at the top.

You must change all Apartments.Locations definitions in the file to Apartments.

For example: client line 136.

TriggerServerEvent("apartments:server:CreateApartment", appaYeet, Apartments.Locations[appaYeet].label) Instead 
> to
TriggerServerEvent("apartments:server:CreateApartment", appaYeet, Apartments[appaYeet].label)
-- As you can see, instead of `Apartments.Locations` I wrote `Apartments`

4- qb-spawn/client.lua line 135 / function RegisterNUICallback('chooseAppa', function(data, cb)

    local appaYeet = tonumber(data.appType) or data.appType
	if type(appaYeet) == "number" then
		appaYeet = appaYeet + 1
	end

Then restart your server. Everything should work properly. Please don't create a support ticket until you are sure everything is working properly.

What You Need to Know

  • Q: Where is the sql file ?

  • A: database.sql

  • Q: How to add a motel ?

  • A: You can take an example from Config.Apartments in the Config file.

Last updated