diff --git a/[core]/esx_multicharacter/server/modules/database.lua b/[core]/esx_multicharacter/server/modules/database.lua index 96294523e..e3fc245c6 100644 --- a/[core]/esx_multicharacter/server/modules/database.lua +++ b/[core]/esx_multicharacter/server/modules/database.lua @@ -72,7 +72,7 @@ MySQL.ready(function() end) function Database:DeleteCharacter(source, charid) - local identifier = ("%s%s:%s"):format(Server.prefix, charid, Server:GetIdentifier(source)) + local identifier = ("%s%s:%s"):format(Server.prefix, charid, ESX.GetIdentifier(source)) local query = "DELETE FROM `%s` WHERE %s = ?" local queries = {} local count = 0 @@ -140,4 +140,4 @@ function Database:DisableSlot(identifier, slot) return updated > 0 end -Database:GetConnection() \ No newline at end of file +Database:GetConnection() diff --git a/[core]/esx_multicharacter/server/modules/functions.lua b/[core]/esx_multicharacter/server/modules/functions.lua index f1750e2fb..d9c226075 100644 --- a/[core]/esx_multicharacter/server/modules/functions.lua +++ b/[core]/esx_multicharacter/server/modules/functions.lua @@ -1,20 +1,10 @@ -function Server:GetIdentifier(source) - local fxDk = GetConvarInt("sv_fxdkMode", 0) - if fxDk == 1 then - return "ESX-DEBUG-LICENCE" - end - - local identifier = GetPlayerIdentifierByType(source, self.identifierType) - return identifier and identifier:gsub(self.identifierType .. ":", "") -end - function Server:ResetPlayers() if next(ESX.Players) then local players = table.clone(ESX.Players) table.wipe(ESX.Players) for _, v in pairs(players) do - ESX.Players[self:GetIdentifier(v.source)] = true + ESX.Players[ESX.GetIdentifier(v.source)] = true end else ESX.Players = {} @@ -24,8 +14,8 @@ end function Server:OnConnecting(source, deferrals) deferrals.defer() Wait(0) -- Required - local identifier = self:GetIdentifier(source) - + local identifier = ESX.GetIdentifier(source) + -- luacheck: ignore if not SetEntityOrphanMode then return deferrals.done(("[ESX] ESX Requires a minimum Artifact version of 10188, Please update your server.")) diff --git a/[core]/esx_multicharacter/server/modules/multicharacter.lua b/[core]/esx_multicharacter/server/modules/multicharacter.lua index c43be5819..55a8b9a0c 100644 --- a/[core]/esx_multicharacter/server/modules/multicharacter.lua +++ b/[core]/esx_multicharacter/server/modules/multicharacter.lua @@ -10,7 +10,7 @@ function Multicharacter:SetupCharacters(source) Wait(100) end - local identifier = Server:GetIdentifier(source) + local identifier = ESX.GetIdentifier(source) ESX.Players[identifier] = true local slots = Database:GetPlayerSlots(identifier) @@ -69,24 +69,25 @@ function Multicharacter:CharacterChosen(source, charid, isNew) self.awaitingRegistration[source] = charid else SetPlayerRoutingBucket(source, 0) + local identifier = ESX.GetIdentifier(source) if not ESX.GetConfig().EnableDebug then - local identifier = ("%s%s:%s"):format(Server.prefix, charid, Server:GetIdentifier(source)) + local formattedIdentifier = ("%s%s:%s"):format(Server.prefix, charid, identifier) - if ESX.GetPlayerFromIdentifier(identifier) then - DropPlayer(source, "[ESX Multicharacter] Your identifier " .. identifier .. " is already on the server!") + if ESX.GetPlayerFromIdentifier(formattedIdentifier) then + DropPlayer(source, "[ESX Multicharacter] Your identifier " .. formattedIdentifier .. " is already on the server!") return end end TriggerEvent("esx:onPlayerJoined", source, ("%s%s"):format(Server.prefix, charid)) - ESX.Players[Server:GetIdentifier(source)] = true + ESX.Players[identifier] = true end end function Multicharacter:RegistrationComplete(source, data) local charId = self.awaitingRegistration[source] self.awaitingRegistration[source] = nil - ESX.Players[Server:GetIdentifier(source)] = true + ESX.Players[ESX.GetIdentifier(source)] = true SetPlayerRoutingBucket(source, 0) TriggerEvent("esx:onPlayerJoined", source, ("%s%s"):format(Server.prefix, charId), data) @@ -94,5 +95,5 @@ end function Multicharacter:PlayerDropped(player) self.awaitingRegistration[player] = nil - ESX.Players[Server:GetIdentifier(player)] = nil + ESX.Players[ESX.GetIdentifier(player)] = nil end