> For the complete documentation index, see [llms.txt](https://0bugscripts.gitbook.io/0bugscripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0bugscripts.gitbook.io/0bugscripts/zbug-scripts/zbug-locations/installation.md).

# Installation

### **•** STEP 1: DEPENDENCIES

Make sure you have this resources installed in your server!

1. <mark style="color:blue;">esx</mark> or <mark style="color:orange;">qbcore</mark> (if you have different core name, you must change that in the config file).
2. If you have Starting Appartment set to <mark style="color:blue;">'true'</mark> in the Multicharacter and Identity <mark style="color:green;">config</mark> you need to have <mark style="color:orange;">qb-spawn</mark> installed.

**• STEP 2: START ORDER**

```lua
ensure zr-locations
```

### **• STEP 3: DATABASE**

{% hint style="success" %}
This script doesn't require any database installation.
{% endhint %}

### **• STEP 4: EVENT NAME**

{% hint style="info" %}
Display the locations menu from **Server Side.**
{% endhint %}

```lua
TriggerClientEvent('zr-locations:start', source)
```

**Examples:**

1\. If you have qb-multicharacter you must do the following changes:

<pre class="language-lua"><code class="lang-lua"><strong>RegisterNetEvent('qb-multicharacter:server:loadUserData', function(cData)
</strong>    local src = source
    if QBCore.Player.Login(src, cData.citizenid) then
        repeat
            Wait(10)
        until hasDonePreloading[src]
        print('^2[qb-core]^7 '..GetPlayerName(src)..' (Citizen ID: '..cData.citizenid..') has succesfully loaded!')
        QBCore.Commands.Refresh(src)
        loadHouseData(src)
        --TriggerClientEvent('apartments:client:setupSpawnUI', src, cData)
        TriggerClientEvent('zr-locations:start', src)
        TriggerEvent("qb-log:server:CreateLog", "joinleave", "Loaded", "green", "**".. GetPlayerName(src) .. "** (&#x3C;@"..(QBCore.Functions.GetIdentifier(src, 'discord'):gsub("discord:", "") or "unknown").."> |  ||"  ..(QBCore.Functions.GetIdentifier(src, 'ip') or 'undefined') ..  "|| | " ..(QBCore.Functions.GetIdentifier(src, 'license') or 'undefined') .." | " ..cData.citizenid.." | "..src..") loaded..")
    end
end)
</code></pre>

2\. If you have esx\_multicharacter you must do the following changes:

```lua
RegisterNetEvent('esx_multicharacter:CharacterChosen', function(charid, isNew)
    if type(charid) == 'number' and string.len(charid) <= 2 and type(isNew) == 'boolean' then
	if isNew then
	    awaitingRegistration[source] = charid
        else
	    TriggerEvent('esx:onPlayerJoined', source, PREFIX..charid)
	    ESX.Players[GetIdentifier(source)] = true
	    TriggerClientEvent('zr-locations:start', source)
	end
    end
end)
```
