Events
WE SUGGEST YOU HAVE SOME KNOWLEDGE ABOUT CODING BEFORE CONTINUING. IF YOU BREAK SOMETHING, WE WILL NOT TROUBLESHOOT THROUGH IT WITH YOU.
Introduction
This page will guide you through how to use our custom events so the UI will be displayed at just the right time for your new players. Please read each step carefully and do NOT skip any steps.
Step 1: Ensure Order
Be sure that g_core
is started before any script your trying to incorporate g_lifestyle
with because we are going to be using some exports that require our core (which makes it easy for you).
Example of how it should look
ensure ox_lib
ensure your_framework
ensure your_inventory
ensure your_target3rdeye
ensure g_core
ensure g_lifestyle
ensure your_script_here
Step 2: Config
Open the config.lua
file and find cfg.openauto
and switch from true
to false

Step 3: Inserting Event
Insert all lines below into the script of your choice. Most likely a multi character script 😄
Client Side
This code will work for ESX, QBCore & QBox
local xcoreid = GetPlayerServerId(PlayerId())
if GetResourceState('qbx_core') == 'started' then
local gPlayer = QBX.PlayerData
TriggerServerEvent('g_lifestyle:sv:getdatabase', xcoreid, gPlayer.citizenid)
elseif GetResourceState('qb-core') == 'started' then
local QBCore = exports['qb-core']:GetCoreObject()
local gPlayer = QBCore.Functions.GetPlayerData()
TriggerServerEvent('g_lifestyle:sv:getdatabase', xcoreid, gPlayer.citizenid)
elseif GetResourceState('es_extended') == 'started' then
local ESX = exports.es_extended:getSharedObject()
local gPlayer = ESX.GetPlayerData()
TriggerServerEvent('g_lifestyle:sv:getdatabase', xcoreid, gPlayer.identifier)
end
Last updated