diff --git a/client/framework.lua b/client/framework.lua index a713174..cf9601d 100644 --- a/client/framework.lua +++ b/client/framework.lua @@ -1,10 +1,7 @@ -local Framework = Config.framework -QBCore, ESX, FullyLoaded = nil, nil, nil --luacheck: ignore -if Framework == 'qb' then - QBCore = exports['qb-core']:GetCoreObject() --luacheck: ignore - FullyLoaded = Framework == 'qb' and LocalPlayer.state.isLoggedIn -elseif Framework == 'qbx' then - FullyLoaded = Framework == 'qbx' and LocalPlayer.state.isLoggedIn +local Framework = GetResourceState('es_extended') == 'started' and 'esx' or GetResourceState('qbx_core') == 'started' and 'qbx' or GetResourceState('qb-core') == 'started' and 'qb' or 'Unknown' +FullyLoaded = false +if Framework == 'qb' or Framework == 'qbx' then + FullyLoaded = LocalPlayer.state.isLoggedIn elseif Framework == 'esx' then ESX = exports['es_extended']:getSharedObject() FullyLoaded = Framework == 'esx' and ESX.PlayerLoaded or false diff --git a/client/main.lua b/client/main.lua index d58f421..cbf43c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -96,17 +96,18 @@ function CreatePeds() coords = coords, distance = 300, model = joaat(Config.peds[k].model), + heading = coords.w, ped = nil, - targetOptions = Config.peds[k].createAccounts and {{ + targetOptions = {{ name = 'renewed_banking_accountmng', event = 'Renewed-Banking:client:accountManagmentMenu', icon = 'fas fa-money-check', label = locale('manage_bank'), atm = false, canInteract = function(_, distance) - return distance < 4.5 + return distance < 4.5 and Config.peds[k].createAccounts end - }} or {{ + },{ name = 'renewed_banking_openui', event = 'Renewed-Banking:client:openBankUI', icon = 'fas fa-money-check', @@ -121,7 +122,8 @@ function CreatePeds() function pedPoint:onEnter() lib.requestModel(self.model, 10000) - self.ped = CreatePed(0, self.model, self.coords.x, self.coords.y, self.coords.z-1, self.coords.w, false, false) + self.ped = CreatePed(0, self.model, self.coords.x, self.coords.y, self.coords.z-1, self.heading, false, false) + SetEntityHeading(self.ped, self.heading) SetModelAsNoLongerNeeded(self.model) TaskStartScenarioInPlace(self.ped, 'PROP_HUMAN_STAND_IMPATIENT', 0, true) diff --git a/config.lua b/config.lua index 19f1e5a..4b441c9 100644 --- a/config.lua +++ b/config.lua @@ -1,6 +1,7 @@ lib.locale() Config = { - framework = 'qb', -- QB, QBX, and ESX preconfigured edit the framework.lua to add functionality to other frameworks + -- Framework automatically detected + -- QB, QBX, and ESX preconfigured edit the framework.lua to add functionality to other frameworks renewedMultiJob = false, -- QBCORE ONLY! https://github.com/Renewed-Scripts/qb-phone progressbar = 'circle', -- circle or rectangle (Anything other than circle will default to rectangle) currency = 'USD', -- USD, EUR, GBP ect..... diff --git a/server/framework.lua b/server/framework.lua index cf7a040..29b0c9b 100644 --- a/server/framework.lua +++ b/server/framework.lua @@ -1,4 +1,4 @@ -local Framework = Config.framework == 'qb' and 'qb' or Config.framework == 'qbx' and 'qbx' or Config.framework == 'esx' and 'esx' or 'Unknown' +local Framework = GetResourceState('es_extended') == 'started' and 'esx' or GetResourceState('qbx_core') == 'started' and 'qbx' or GetResourceState('qb-core') == 'started' and 'qb' or 'Unknown' local QBCore, ESX, Jobs, Gangs = nil, nil, nil, nil local deadPlayers = {} @@ -29,10 +29,11 @@ CreateThread(function() ExportHandler("qb-management", "AddGangMoney", AddAccountMoney) ExportHandler("qb-management", "RemoveMoney", RemoveAccountMoney) ExportHandler("qb-management", "RemoveGangMoney", RemoveAccountMoney) - elseif Framework == 'esx'then + elseif Framework == 'esx' then ESX = exports['es_extended']:getSharedObject() ESX.RefreshJobs() Jobs = ESX.GetJobs() + Gangs = {} -- ESX doesn't have gangs -- Backwards Compatability ExportHandler("esx_society", "GetSociety", GetAccountMoney)