fixes(client): Resolve issues with character selection, deletion, and new characters

- Disable controls while on character select
- Disable NUI if there are no characters
- Set the players skin after deleting a character
- Set the default ped appearance when creating a new character
This commit is contained in:
Linden
2021-05-21 05:39:03 +10:00
parent 26464aafea
commit ed428b488a
2 changed files with 119 additions and 4 deletions
+21 -4
View File
@@ -34,10 +34,21 @@ if ESX.GetConfig().Multichar then
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", Config.Spawn.x, Config.Spawn.y+1.6, Config.Spawn.z+0.5, 0.0, 0.0, 180.0, 100.00, false, 0)
SetCamActive(cam, true)
RenderScriptCams(true, false, 1, true, true)
SetPlayerControl(PlayerId(), false, false)
end)
StartLoop = function()
Citizen.CreateThread(function()
while true do
if hidePlayers == false then break end
DisableAllControlActions(0)
EnableControlAction(0, 173, true)
EnableControlAction(0, 177, true)
EnableControlAction(0, 18, true)
EnableControlAction(0, 27, true)
EnableControlAction(0, 200, true)
Citizen.Wait(5)
end
end)
Citizen.CreateThread(function()
while true do
if hidePlayers == false then break end
@@ -89,9 +100,12 @@ if ESX.GetConfig().Multichar then
LoadPed = function(isNew, skin)
if isNew then
if skin.sex == 0 then isMale = true else isMale = false end
local isMale = false
if skin.sex == 1 then isMale = false end
TriggerEvent('skinchanger:loadDefaultModel', isMale, function()
TriggerEvent('skinchanger:loadSkin', {sex = skin.sex})
local newSkin = Config.Default
newSkin.sex = skin.sex
TriggerEvent('skinchanger:loadSkin', newSkin)
Citizen.Wait(500)
TriggerEvent('esx_skin:openSaveableMenu')
end)
@@ -104,6 +118,9 @@ if ESX.GetConfig().Multichar then
local elements = {}
if #Characters == 0 then
SendNUIMessage({
action = "closeui"
})
exports.spawnmanager:spawnPlayer({
x = Config.Spawn.x,
y = Config.Spawn.y,
@@ -162,6 +179,7 @@ if ESX.GetConfig().Multichar then
if data.current.value then
TriggerServerEvent('esx_multicharacter:DeleteCharacter', data.current.value)
table.remove(Characters, data.current.value)
Spawned = false
ESX.UI.Menu.CloseAll()
TriggerServerEvent('esx_multicharacter:SetupCharacters')
Citizen.Wait(100)
@@ -241,7 +259,6 @@ if ESX.GetConfig().Multichar then
DisplayHud(true)
DisplayRadar(true)
FreezeEntityPosition(playerPed, false)
SetPlayerControl(PlayerId(), true, false)
SetEntityHeading(playerPed, spawn.heading)
hidePlayers = false
end)
+98
View File
@@ -3,3 +3,101 @@ Config.Locale = 'en'
Config.Slots = 4
Config.Spawn = vector4(-113.7, 565.3, 196, 0)
Config.Default = {
mom = 21,
dad = 0,
face_md_weight = 50,
skin_md_weight = 50,
nose_1 = 0,
nose_2 = 0,
nose_3 = 0,
nose_4 = 0,
nose_5 = 0,
nose_6 = 0,
cheeks_1 = 0,
cheeks_2 = 0,
cheeks_3 = 0,
lip_thickness = 0,
jaw_1 = 0,
jaw_2 = 0,
chin_1 = 0,
chin_2 = 0,
chin_13 = 0,
chin_4 = 0,
neck_thickness = 0,
hair_1 = 0,
hair_2 = 0,
hair_color_1 = 0,
hair_color_2 = 0,
tshirt_1 = 0,
tshirt_2 = 0,
torso_1 = 0,
torso_2 = 0,
decals_1 = 0,
decals_2 = 0,
arms = 0,
arms_2 = 0,
pants_1 = 0,
pants_2 = 0,
shoes_1 = 0,
shoes_2 = 0,
mask_1 = 0,
mask_2 = 0,
bproof_1 = 0,
bproof_2 = 0,
chain_1 = 0,
chain_2 = 0,
helmet_1 = -1,
helmet_2 = 0,
glasses_1 = 0,
glasses_2 = 0,
watches_1 = -1,
watches_2 = 0,
bracelets_1 = -1,
bracelets_2 = 0,
bags_1 = 0,
bags_2 = 0,
eye_color = 0,
eye_squint = 0,
eyebrows_2 = 0,
eyebrows_1 = 0,
eyebrows_3 = 0,
eyebrows_4 = 0,
eyebrows_5 = 0,
eyebrows_6 = 0,
makeup_1 = 0,
makeup_2 = 0,
makeup_3 = 0,
makeup_4 = 0,
lipstick_1 = 0,
lipstick_2 = 0,
lipstick_3 = 0,
lipstick_4 = 0,
ears_1 = -1,
ears_2 = 0,
chest_1 = 0,
chest_2 = 0,
chest_3 = 0,
bodyb_1 = -1,
bodyb_2 = 0,
bodyb_3 = -1,
bodyb_4 = 0,
age_1 = 0,
age_2 = 0,
blemishes_1 = 0,
blemishes_2 = 0,
blush_1 = 0,
blush_2 = 0,
blush_3 = 0,
complexion_1 = 0,
complexion_2 = 0,
sun_1 = 0,
sun_2 = 0,
moles_1 = 0,
moles_2 = 0,
beard_1 = 0,
beard_2 = 0,
beard_3 = 0,
beard_4 = 0
}