fix: Ensure character is deleted on the server before refreshing client

This commit is contained in:
Linden
2021-07-26 20:59:58 +10:00
parent 83bae12c0f
commit 9dbe1c5cbe
+10 -3
View File
@@ -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)