mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 01:08:54 +00:00
fix(server): clone and wipe the playerlist when restarting the resource
Since we're looping through the table, we end up trying to index new values as they are added.
This commit is contained in:
+5
-3
@@ -40,7 +40,9 @@ elseif ESX.GetConfig().Multichar == true then
|
||||
end
|
||||
|
||||
if next(ESX.Players) then
|
||||
for k, v in pairs(ESX.Players) do
|
||||
local players = table.clone(ESX.Players)
|
||||
table.wipe(ESX.Players)
|
||||
for _, v in pairs(players) do
|
||||
ESX.Players[GetIdentifier(v.source)] = true
|
||||
end
|
||||
else ESX.Players = {} end
|
||||
@@ -48,9 +50,9 @@ elseif ESX.GetConfig().Multichar == true then
|
||||
local function SetupCharacters(source)
|
||||
while not FETCH do Citizen.Wait(100) end
|
||||
local identifier = GetIdentifier(source)
|
||||
ESX.Players[identifier] = true
|
||||
ESX.Players[identifier] = true
|
||||
|
||||
local slots = MySQL.Sync.fetchScalar("SELECT slots FROM multicharacter_slots WHERE identifier = ?", {
|
||||
local slots = MySQL.Sync.fetchScalar("SELECT slots FROM multicharacter_slots WHERE identifier = ?", {
|
||||
identifier
|
||||
}) or SLOTS
|
||||
identifier = PREFIX..'%:'..identifier
|
||||
|
||||
Reference in New Issue
Block a user