From c97daae2a963dd6e5e424d3aaf092e8fcc49549c Mon Sep 17 00:00:00 2001 From: Linden Date: Mon, 28 Jun 2021 19:00:17 +1000 Subject: [PATCH] improvements(client): Hide HUD components while active; refactor --- client/main.lua | 23 +++++++++++++---------- fxmanifest.lua | 2 +- readme.md | 7 +++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/client/main.lua b/client/main.lua index 4ea6edb5..f79c29b5 100644 --- a/client/main.lua +++ b/client/main.lua @@ -32,8 +32,6 @@ if ESX.GetConfig().Multichar then SetCamActive(cam, true) RenderScriptCams(true, false, 1, true, true) ESX.UI.HUD.SetDisplay(0.0) - DisplayHud(false) - DisplayRadar(false) StartLoop() ShutdownLoadingScreen() ShutdownLoadingScreenNui() @@ -55,6 +53,11 @@ if ESX.GetConfig().Multichar then SetEntityVisible(PlayerPedId(), 0, 0) SetLocalPlayerVisibleLocally(1) SetPlayerInvincible(PlayerId(), 1) + ThefeedHideThisFrame() + HideHudComponentThisFrame(11) + HideHudComponentThisFrame(12) + HideHudComponentThisFrame(21) + HideHudAndRadarThisFrame() Citizen.Wait(3) local vehicles = GetGamePool('CVehicle') for i=1, #vehicles do @@ -106,7 +109,10 @@ if ESX.GetConfig().Multichar then end TriggerEvent('skinchanger:loadSkin', skin) end + DoScreenFadeIn(400) + while IsScreenFadedOut() do Citizen.Wait(100) end end) + elseif Characters[index] and Characters[index].skin then if Characters[Spawned] and Characters[Spawned].model then RequestModel(Characters[index].model) @@ -119,15 +125,15 @@ if ESX.GetConfig().Multichar then end TriggerEvent('skinchanger:loadSkin', Characters[index].skin) end - FreezeEntityPosition(PlayerPedId(), true) Spawned = index - SendNUIMessage({ - action = "openui", - character = Characters[index] - }) local playerPed = PlayerPedId() + FreezeEntityPosition(PlayerPedId(), true) SetPedAoBlobRendering(playerPed, true) SetEntityAlpha(playerPed, 255) + SendNUIMessage({ + action = "openui", + character = Characters[Spawned] + }) end RegisterNetEvent('esx_multicharacter:SetupUI') @@ -141,7 +147,6 @@ if ESX.GetConfig().Multichar then SendNUIMessage({ action = "closeui" }) - exports.spawnmanager:forceRespawn() exports.spawnmanager:spawnPlayer({ x = Config.Spawn.x, y = Config.Spawn.y, @@ -168,8 +173,6 @@ if ESX.GetConfig().Multichar then local label = v.firstname..' '..v.lastname elements[#elements+1] = {label = label, value = v.id} end - DoScreenFadeIn(400) - Citizen.Wait(400) if #elements < Config.Slots then elements[#elements+1] = {label = _('create_char'), value = (#elements+1), new = true} end diff --git a/fxmanifest.lua b/fxmanifest.lua index e41f9719..57787aaa 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,7 +1,7 @@ fx_version 'adamant' game 'gta5' description 'https://github.com/thelindat/esx_multicharacter' -version '1.2.0' +version '1.2.1' dependencies { 'es_extended', diff --git a/readme.md b/readme.md index c6c5341f..7fa5bfea 100644 --- a/readme.md +++ b/readme.md @@ -9,8 +9,7 @@ - Modify your ESX config with `Config.Multichar = true` - Set your database name for `Config.Database` in server/main.lua - All owner and identifier columns should be set to `VARCHAR(60)` to ensure correct data entry -- Use the `varchar` command from the console to update your SQL tables -- Once you have used the command you should just remove it for sanity's sake + - The resource will attempt to set columns automatically ### Conflicts * The following resources should not be used with ESX Legacy and can result in errors @@ -19,14 +18,14 @@ - fivem-map-skater - fivem-map-hipster - default_spawnpoint - - cui_character (or other resources that modify spawn behaviour) ### Common issues #### Black screen / loading scripts - Download and run all requirements + - Use a fresh spawnmanager as many people alter the code - Ensure none of the conflicting resources are enabled #### mysql-async duplicate entry - - You have not increased the VARCHAR size of your tables (use the command) + - You have not increased the VARCHAR size of the table holding identifiers - usually `owner` or `identifier` #### The menu interface is esx_menu_default - you can use any version if you want a different appearance ![image](https://user-images.githubusercontent.com/65407488/119010385-592a8c80-b9d7-11eb-9aa1-eb7051004843.png)