Dynamic slots (#36)

* Removed slots configuration

* feature: dynamic slots

* fixes + improvements

* edited core functionality

* added commands for slots management

* added commands english locale

Co-authored-by: d3rp-jsx <15928886+derp-jsx@users.noreply.github.com>
This commit is contained in:
Demetrio
2021-08-10 19:31:30 +02:00
committed by GitHub
parent 248b6e0b92
commit 52250d0d49
5 changed files with 65 additions and 6 deletions
+4 -3
View File
@@ -142,9 +142,10 @@ if ESX.GetConfig().Multichar then
end
RegisterNetEvent('esx_multicharacter:SetupUI')
AddEventHandler('esx_multicharacter:SetupUI', function(data)
AddEventHandler('esx_multicharacter:SetupUI', function(data, slots)
DoScreenFadeOut(0)
Characters = data
local slots = slots
local elements = {}
local Character = next(Characters)
exports.spawnmanager:forceRespawn()
@@ -179,7 +180,7 @@ if ESX.GetConfig().Multichar then
local label = v.firstname..' '..v.lastname
elements[#elements+1] = {label = label, value = v.id}
end
if #elements < Config.Slots then
if #elements < slots then
elements[#elements+1] = {label = _('create_char'), value = (#elements+1), new = true}
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'selectchar', {
@@ -228,7 +229,7 @@ if ESX.GetConfig().Multichar then
else
ESX.UI.Menu.CloseAll()
local GetSlot = function()
for i=1, Config.Slots do
for i=1, slots do
if not Characters[i] then
return i
end