โš™๏ธConfiguration

Spawn Selector TriggerEvent

-- Default startup
TriggerEvent('0bug_Spawnselector:OpenUI') 

-- Create Private Locations

event = {
  event = "test:open:menu",
  side = "client" -- "server", "client"
}

TriggerEvent('0bug_Spawnselector:CustomOpenUI', locations, event)

--- @param locations object Create private locations.
--- @param event object Event.
--- @return boolean Status (true: success, false: error).

-- First Join / Apartments Startup 
TriggerEvent('0bug_Spawnselector:OpenUI', identifier, new) 

--- @param identifier string Character identifier/citizenid.
--- @param new boolean New character.
--- @return boolean Status (true: success, false: error).

General Settings

  • LastLocation: Enables respawn at the player's last location. (true/false)

  • SpawnHouses: Enables house-based spawn points (Owned houses) .(true/false)

  • Jobs: Enables job-specific spawn points. (true/false)

  • PublicLocations: Enables general public spawn locations. (true/false)

  • SmoothCamTime: Sets the smooth camera transition time in milliseconds.

Apartment Settings

  • Apartments: Enables apartment-based spawn points. (true/false)

  • ApartmentScriptName: The name of your apartment script. Default is "qb-apartments".

  • ApartmentsLocations: Auto-filled by the apartment script.

Custom Apartment Locations

  • GetApartments: A function to define custom apartment locations. Example usage:

GetApartments = function()
   --[[
    WIZF.AddLocation({
      type = "home",
      name = "Apartment",
      adress = "",
      coords = vector3(x, y, z),
      target = "apartment"
    })
  ]]
  end,

House Settings

  • HousesLocations: Auto-filled by the house script.

  • SQL_SELECT_HOUSES_LOCATION: Database query configuration for fetching house locations:

    • table: The database table name (default: "player_houses").

    • identifierColonName: Column for player identification (default: "citizenid").

    • selectColon: Column for the house identifier (default: "house").

Custom House Logic

  • GetOwnedHouses: Fetches owned houses and adds them to the spawn selector. Example:

    GetOwnedHouses = function()
        Callback("GetOwnedHouses", function(data)
          if data ~= nil then
            WIZF.AddLocation({
              type = "home",
              name = Locales[Config.Lang].myHome,
              adress = Locales[Config.Lang].myHomeAdress,
              coords = Config.Houses[data] ~= nil and Config.Houses[data].coords.enter,
              target = "house",
              data = data
            })
          end
        end)
      end,

Player Spawn Function

SpawnPlayer = function()
    DoScreenFadeIn(200)
    -- ESX
    TriggerServerEvent('esx:onPlayerSpawn')
    TriggerEvent('esx:onPlayerSpawn')
    TriggerEvent('playerSpawned')

    -- QBCORE
    TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
    TriggerEvent('QBCore:Client:OnPlayerLoaded')
  end,

Adding Location Example

{
  name = "Police Department",
  address = "Police Station",
  type = "job",
  coords = vector4(428.23, -984.28, 29.76, 3.5),
  job = "police"
}

Translations

Locales["en"] = {
  frontTitle = "SPAWN",
  backTitle = "SELECTOR",
  spawnText = "SPAWN",
  lastLocationName = "Last Location",
  lastLocationAdress = "",
  myHome = "My Home",
  myHomeAdress = "Comfort in every corner"
}

Framework Configuration Guide

If you're using a different framework path/name (e.g., np-core instead of qb-core), you'll need to modify the threads.lua file in 0bug-core:

  1. Open 0bug-core/threads.lua

  2. Locate the GetFramework() function

  3. Modify the export paths according to your framework:

function GetFramework()
    local Get = nil
    
    -- For ESX with custom path
    if WIZ_CONFIG.Framework == "ESX" then
        Get = exports['your-es-extended-path']:getSharedObject()
        if Get == nil then
            while Get == nil do
                TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
                Citizen.Wait(200)
            end
        end
    end
    
    -- For QBCore with custom path (e.g., bl-core)
    if WIZ_CONFIG.Framework == "QBCore" then
        Get = exports["your-qb-path"]:GetCoreObject()  -- Example: exports["bl-core"]:GetCoreObject()
        if Get == nil then
            while Get == nil do
                TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
                Citizen.Wait(200)
            end
        end
    end
    
    -- For QBox with custom path 
     if WIZ_CONFIG.Framework == "QBox" then
        Get = exports['your-qbox-path']:GetCoreObject()
        if Get == nil then
            while Get == nil do
                Get = exports['qb-core']:GetCoreObject()
                Citizen.Wait(200)
            end
        end
    end
    
    return Get
end

Last updated