mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
fix: Ensure character is deleted on the server before refreshing client
This commit is contained in:
+10
-3
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user