mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
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:
+4
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user