qbcore-framework / qb-apartments

Apartment Script Used With QB-Core :house:
GNU General Public License v3.0
26 stars 199 forks source link

[BUG] Loading screen is stuck after selecting apartment #106

Closed MriKNG closed 1 year ago

MriKNG commented 1 year ago

Describe the bug Whenever someone creates a new character and choose their apartment, they are greeted with an infinite black screen. It then pops up the UI of the apartment and they have to disconnect, load back in and then they have a default skin without the ability to change their clothes.

Steps to reproduce the behavior

  1. Connect to the server
  2. Create a new character
  3. Select the desired apartment
  4. See the error

Expected behavior When you select the desired apartment you are to spawn in at the apartment and then the clothing menu should pop-up to change your characters clothes.

Questions (please complete the following information) When you last updated: 1 day ago Are you using custom resource? which ones? illenium-appearance (edit of fivem-appearance) to replace qb-clothing, qb-spawn / qb-apartments and qb-spawn edit by marcostom32 Have you renamed qb- to something custom? No

Additional context My oxmysql has been updated to the latest version.

In qb-multicharacter i replaced 2 events. qb-multicharacter:server:getSkin has been edited with QBCore.Functions.CreateCallback("qb-multicharacter:server:getSkin", function(_, cb, cid) local result = MySQL.query.await('SELECT * FROM playerskins WHERE citizenid = ? AND active = ?', {cid, 1}) if result[1] ~= nil then cb(json.decode(result[1].skin)) else cb(nil) end end)

and

RegisterNUICallback('cDataPed', function(nData, cb) has been edited with RegisterNUICallback('cDataPed', function(nData, cb) local cData = nData.cData SetEntityAsMissionEntity(charPed, true, true) DeleteEntity(charPed) if cData ~= nil then QBCore.Functions.TriggerCallback('qb-multicharacter:server:getSkin', function(skinData) if skinData then local model = skinData.model CreateThread(function() RequestModel(GetHashKey(model)) while not HasModelLoaded(GetHashKey(model)) do Wait(10) end charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true) local RandomAnims = { "WORLD_HUMAN_HANG_OUT_STREET", "WORLD HUMAN STAND IMPATIENT", "WORLD_HUMAN_STAND_MOBILE", "WORLD_HUMAN_SMOKING_POT", "WORLD_HUMAN_LEANING", "WORLD_HUMAN_DRUG DEALER_HARD", "WORLD_HUMAN_SUPERHERO", "WORLD_HUMAN_TOURIST_MAP", "WORLD_HUMAN YOGA", "WORLD_HUMAN_BINOCULARS", "WORLD HUMAN BUM WASH", "WORLD_HUMAN_CONST_DRILL", "WORLD_HUMAN_MOBILE_FILM_SHOCKING", "WORLD HUMAN MUSCLE FLEX", "WORLD_HUMAN_MUSICIAN", "WORLD_HUMAN_PAPARAZZI", "WORLD_HUMAN_PARTYING", } local PlayAnim = RandomAnims[math.random(#RandomAnims)] SetPedCanPlayAmbientAnims(charPed, true) TaskStartScenarioInPlace(charPed, PlayAnim, 0, true) SetPedComponentVariation(charPed, 0, 0, 0, 2) FreezeEntityPosition(charPed, false) SetEntityInvincible(charPed, true) PlaceObjectOnGroundProperly(charPed) SetBlockingOfNonTemporaryEvents(charPed, true) exports['illenium-appearance']:setPedAppearance(charPed, skinData) end) else CreateThread(function() local randommodels = { "mp_m_freemode_01", "mp_f_freemode_01", } local model = GetHashKey(randommodels[math.random(1, #randommodels)]) RequestModel(model) while not HasModelLoaded(model) do Wait(0) end charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true) SetPedComponentVariation(charPed, 0, 0, 0, 2) FreezeEntityPosition(charPed, false) SetEntityInvincible(charPed, true) PlaceObjectOnGroundProperly(charPed) SetBlockingOfNonTemporaryEvents(charPed, true) end) end cb("ok") end, cData.citizenid) else CreateThread(function() local randommodels = { "mp_m_freemode_01", "mp_f_freemode_01", } local model = GetHashKey(randommodels[math.random(1, #randommodels)]) RequestModel(model) while not HasModelLoaded(model) do Wait(0) end charPed = CreatePed(2, model, Config.PedCoords.x, Config.PedCoords.y, Config.PedCoords.z - 0.98, Config.PedCoords.w, false, true) SetPedComponentVariation(charPed, 0, 0, 0, 2) FreezeEntityPosition(charPed, false) SetEntityInvincible(charPed, true) PlaceObjectOnGroundProperly(charPed) SetBlockingOfNonTemporaryEvents(charPed, true) end) cb("ok") end end)

Removed qb-clothing from the dependencies section of fxmanifest.lua in qb-houses and qb-apartments

Imported 2 SQL files CREATE TABLE IF NOT EXISTS playerskins ( id int(11) NOT NULL AUTO_INCREMENT, citizenid varchar(255) NOT NULL, model varchar(255) NOT NULL, skin text NOT NULL, active tinyint(4) NOT NULL DEFAULT 1, PRIMARY KEY (id), KEY citizenid (citizenid), KEY active (active) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS player_outfits ( id int(11) NOT NULL AUTO_INCREMENT, citizenid varchar(50) DEFAULT NULL, outfitname varchar(50) NOT NULL DEFAULT '0', model varchar(50) DEFAULT NULL, props varchar(1000) DEFAULT NULL, components varchar(1500) DEFAULT NULL, PRIMARY KEY (id), UNIQUE KEY citizenid_outfitname_model (citizenid,outfitname,model), KEY citizenid (citizenid) ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4;

Screenshots Screenshot_2 Screenshot_1