diff --git a/server/main.lua b/server/main.lua index f13d9e82..ea74dafa 100644 --- a/server/main.lua +++ b/server/main.lua @@ -44,12 +44,20 @@ elseif ESX.GetConfig().Multichar == true then local DeleteCharacter = function(playerId, charid) local identifier = Config.Prefix..charid..':'..ESX.GetIdentifier(playerId) + local counter = 0 for k, v in pairs(IdentifierTables) do MySQL.Async.execute("DELETE FROM "..v.table.." WHERE "..v.column.." = ?", { identifier - }) + }, function() + counter = counter + 1 + if counter == #IdentifierTables then + print(('[^2INFO^7] Player [%s] %s has deleted a character (%s)'):format(GetPlayerName(playerId), playerId, identifier)) + Citizen.Wait(100) + SetupCharacters(playerId) + end + end) + Citizen.Wait(5) end - print(('[^2INFO^7] Player [%s] %s has deleted a character (%s)'):format(GetPlayerName(playerId), playerId, identifier)) end MySQL.ready(function() @@ -106,7 +114,6 @@ elseif ESX.GetConfig().Multichar == true then local src = source if type(charid) == "number" and string.len(charid) <= 2 then DeleteCharacter(src, charid) - SetupCharacters(src) end end)