mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
fix(esx): multicharacter support
Properly support custom multicharacter prefixes. Disable playerConnecting event handler when using multicharacter.
This commit is contained in:
@@ -14,7 +14,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.variables = {}
|
||||
self.weight = weight
|
||||
self.maxWeight = Config.MaxWeight
|
||||
if Config.Multichar then self.license = 'license'..string.sub(identifier, 6) else self.license = 'license:'..identifier end
|
||||
if Config.Multichar then self.license = 'license'.. identifier:sub(identifier:find(':'), identifier:len()) else self.license = 'license:'..identifier end
|
||||
|
||||
ExecuteCommand(('add_principal identifier.%s group.%s'):format(self.license, self.group))
|
||||
|
||||
|
||||
@@ -89,21 +89,23 @@ function createESXPlayer(identifier, playerId, data)
|
||||
end
|
||||
end
|
||||
|
||||
AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
deferrals.defer()
|
||||
local playerId = source
|
||||
local identifier = ESX.GetIdentifier(playerId)
|
||||
if not Config.Multichar then
|
||||
AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
|
||||
deferrals.defer()
|
||||
local playerId = source
|
||||
local identifier = ESX.GetIdentifier(playerId)
|
||||
|
||||
if identifier then
|
||||
if ESX.GetPlayerFromIdentifier(identifier) then
|
||||
deferrals.done(('There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same account.\n\nYour identifier: %s'):format(identifier))
|
||||
if identifier then
|
||||
if ESX.GetPlayerFromIdentifier(identifier) then
|
||||
deferrals.done(('There was an error loading your character!\nError code: identifier-active\n\nThis error is caused by a player on this server who has the same identifier as you have. Make sure you are not playing on the same account.\n\nYour identifier: %s'):format(identifier))
|
||||
else
|
||||
deferrals.done()
|
||||
end
|
||||
else
|
||||
deferrals.done()
|
||||
deferrals.done('There was an error loading your character!\nError code: identifier-missing\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')
|
||||
end
|
||||
else
|
||||
deferrals.done('There was an error loading your character!\nError code: identifier-missing\n\nThe cause of this error is not known, your identifier could not be found. Please come back later or report this problem to the server administration team.')
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function loadESXPlayer(identifier, playerId, isNew)
|
||||
local userData = {
|
||||
|
||||
Reference in New Issue
Block a user