Page cover image

πŸ’ΏInstallation

Discover how to install your script.

β€’ STEP 1: DEPENDENCIES

Make sure that the script folder name is zr-locations and that you have the following resources installed in your server!

  1. esx or qbcore (if you have different core name, you must change that in the config file).

  2. If you have Starting Appartment set to 'true' in the Multicharacter and Identity config you need to have qb-spawn installed.

β€’ STEP 2: START ORDER

ensure zr-locations

β€’ STEP 3: DATABASE

β€’ STEP 4: EVENT NAME

Display the locations menu from Server Side.

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

Examples:

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

RegisterNetEvent('qb-multicharacter:server:loadUserData', function(cData)
    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) .. "** (<@"..(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)

2. If you have esx_multicharacter you must do the following changes:

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)

Last updated