REGİSTER

Setup:

System Compatibility and Requirements

Actually, there's not much to write because the system automatically adapts. 😊 Here’s what you need to know:

  • If you are using QBCore, make sure to have qb-apartments and qb-clothing installed because they are required.

  • If you are using the ESX framework, make sure to have esx_skin.

If you have any other questions, don't hesitate to open a ticket! 🎫 This system supports meta data, so everything is automatically detected. 🔄

1. Configuration File

A configuration file in Lua allows you to centrally manage various settings of your game or application. The example below demonstrates a configuration file that supports different frameworks like QBCore and ESX.

Config = {}

Config.Framework = "QBCore" -- QBCore or ESX or OLDQBCore -- NewESX

Config.MySQL = "oxmysql" -- mysql-async or oxmysql or ghmattimysql

Config.steamAPIKey = "steam api" -- Obtain from https://steamcommunity.com/dev/apikey

Config.Spawn = {
    ["spawn"] = vector4(-618.07, 34.54, 43.53, 174.49)
}

Config.UseQbApartments = false -- true or false

Explanation:

  • Config.Framework: Specifies the framework being used (QBCore, ESX, OLDQBCore, or NewESX).

  • Config.MySQL: Indicates the MySQL library to be used (mysql-async, oxmysql, or ghmattimysql).

  • Config.steamAPIKey: Steam API key required for certain functionalities, obtained from the Steam Developer site.

  • Config.Spawn: Defines the spawn location coordinates in the game.

  • Config.UseQbApartments: Boolean value to enable or disable the use of QbApartments.

2. Framework Selection Function

The following Lua function returns the appropriate object based on the user's specified framework. This function allows you to use the framework object for various operations within your game or application.

function GetFramework()
    local Get = nil
    if Config.Framework == "ESX" then
        while Get == nil do
            TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
            Citizen.Wait(0)
        end
    end
    if Config.Framework == "NewESX" then
        Get = exports['es_extended']:getSharedObject()
    end
    if Config.Framework == "QBCore" then
        Get = exports["qb-core"]:GetCoreObject()
    end
    if Config.Framework == "OldQBCore" then
        while Get == nil do
            TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
            Citizen.Wait(200)
        end
    end
    return Get
end

Explanation:

  • Function Purpose: This function determines which framework is being used and returns the corresponding object to interact with the framework's functionality.

Config.Framework == "ESX": Uses an event to get the ESX shared object.
Config.Framework == "NewESX": Directly exports the ESX object.
Config.Framework == "QBCore": Directly exports the QBCore object.
Config.Framework == "OldQBCore": Uses an event to get the old QBCore object.

Last updated