improvements(client): Hide HUD components while active; refactor

This commit is contained in:
Linden
2021-06-28 19:00:17 +10:00
parent f3eb335547
commit c97daae2a9
3 changed files with 17 additions and 15 deletions
+13 -10
View File
@@ -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
+1 -1
View File
@@ -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',
+3 -4
View File
@@ -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)