Skip to content

Commit

Permalink
fix: adding LoadingModelsTimeout (#224)
Browse files Browse the repository at this point in the history
* adding LoadingModelsTimeout

Waiting time for ox_lib to load the models before throws an error, for low specs pc

* Not required

* again not required

* Update functions.lua

---------

Co-authored-by: ChatDisabled <44729807+ChatDisabled@users.noreply.github.com>
  • Loading branch information
SKITTLE6969 and ChatDisabled committed Nov 6, 2023
1 parent 6443232 commit 8244ef8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bridge/qb/client/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,4 @@ function functions.Notify(text, notifyType, duration, subTitle, notifyPosition,
exports.qbx_core:Notify(text, notifyType, duration, subTitle, notifyPosition, notifyStyle, notifyIcon, notifyIconColor)
end

return functions
return functions
8 changes: 4 additions & 4 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ end
local function previewPed(citizenId)
if not citizenId then
local model = randomPedModels[math.random(1, #randomPedModels)]
lib.requestModel(model)
lib.requestModel(model, Config.LoadingModelsTimeout)
SetPlayerModel(cache.playerId, model)
return
end

local clothing, model = lib.callback.await('qbx_core:server:getPreviewPedData', false, citizenId)
if model and clothing then
lib.requestModel(model)
lib.requestModel(model, Config.LoadingModelsTimeout)
SetPlayerModel(cache.playerId, model)
pcall(function() exports['illenium-appearance']:setPedAppearance(PlayerPedId(), json.decode(clothing)) end)
else
model = randomPedModels[math.random(1, #randomPedModels)]
lib.requestModel(model)
lib.requestModel(model, Config.LoadingModelsTimeout)
SetPlayerModel(cache.playerId, model)
end
end
Expand Down Expand Up @@ -384,7 +384,7 @@ CreateThread(function()
if NetworkIsSessionStarted() then
pcall(function() exports.spawnmanager:setAutoSpawn(false) end)
Wait(250)
lib.requestModel(model)
lib.requestModel(model, Config.LoadingModelsTimeout)
SetPlayerModel(cache.playerId, model)
chooseCharacter()
break
Expand Down
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Config.UpdateInterval = 5 -- how often to update player data in minutes
Config.StatusInterval = 5 -- how often to check hunger/thirst status in minutes

Config.Characters = {}
Config.LoadingModelsTimeout = 10000 -- Waiting time for ox_lib to load the models before throws an error, for low specs pc
Config.Characters.UseExternalCharacters = false -- Whether you have an external character management resource. (If true, disables the character management inside the core)
Config.Characters.EnableDeleteButton = true -- Whether players should be able to delete characters themselves.
Config.Characters.StartingApartment = true -- If set to false, skips apartment choice in the beginning (requires qbx_spawn if true)
Expand Down

0 comments on commit 8244ef8

Please sign in to comment.