improvements(client): Conceal the player during character selection; ensure loading screens are disabled

This commit is contained in:
Linden
2021-05-17 20:28:09 +10:00
parent 646bee37f0
commit 837fd4e9a5
2 changed files with 9 additions and 5 deletions
+6 -3
View File
@@ -1,11 +1,11 @@
ESX = exports['es_extended']:getSharedObject()
if ESX.GetConfig().Multichar then
local IsChoosing = true
CreateThread(function()
while true do
Wait(0)
if NetworkIsPlayerActive(PlayerId()) and not ESX.IsPlayerLoaded() then
DoScreenFadeOut(500)
TriggerServerEvent("esx_multicharacter:SetupCharacters")
TriggerEvent("esx_multicharacter:SetupCharacters")
break
@@ -43,6 +43,7 @@ if ESX.GetConfig().Multichar then
RegisterNetEvent('esx_multicharacter:SetupUI')
AddEventHandler('esx_multicharacter:SetupUI', function(Characters)
NetworkConcealPlayer(PlayerId(), 1, 0)
DoScreenFadeIn(500)
Citizen.Wait(500)
SetNuiFocus(true, true)
@@ -50,6 +51,9 @@ if ESX.GetConfig().Multichar then
action = "openui",
characters = Characters,
})
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
TriggerEvent('esx:loadingScreenOff')
end)
RegisterNetEvent('esx_multicharacter:SpawnCharacter')
@@ -67,8 +71,8 @@ if ESX.GetConfig().Multichar then
skipFade = true
}, function()
DoScreenFadeIn(500)
Citizen.Wait(500)
NetworkConcealPlayer(PlayerId(), 0, 0)
cam2 = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93,-1487.78,520.75, 300.00,0.00,0.00, 100.00, false, 0)
PointCamAtCoord(cam2, pos.x,pos.y,pos.z+200)
@@ -102,7 +106,6 @@ if ESX.GetConfig().Multichar then
SetCamActive(cam, false)
DestroyCam(cam, true)
IsChoosing = false
DisplayHud(true)
DisplayRadar(true)
+3 -2
View File
@@ -31,7 +31,7 @@ if ESX.GetConfig().Multichar then
AddEventHandler('esx_multicharacter:SetupCharacters', function()
local playerId = source
local identifier = 'char%:'..ESX.GetIdentifier(playerId)
MySQL.Async.fetchAll("SELECT `identifier`, `accounts`, `job`, `job_grade`, `firstname`, `lastname`, `dateofbirth`, `sex` FROM `users` WHERE `identifier` LIKE @identifier", {
MySQL.Async.fetchAll("SELECT `identifier`, `accounts`, `job`, `job_grade`, `firstname`, `lastname`, `dateofbirth`, `sex`, `skin` FROM `users` WHERE `identifier` LIKE @identifier", {
['@identifier'] = identifier
}, function(result)
local characters = {}
@@ -48,7 +48,8 @@ if ESX.GetConfig().Multichar then
firstname = result[i].firstname,
lastname = result[i].lastname,
dateofbirth = result[i].dateofbirth,
identifier = result[i].identifier
identifier = result[i].identifier,
skin = json.decode(result[i].skin)
}
if result[i].sex == 'm' then characters[i].sex = 'Male' else characters[i].sex = 'Female' end
end