This commit is contained in:
Mycroft
2021-04-28 21:42:12 +01:00
parent bac6cbbb7e
commit 4b2d95059c
8 changed files with 59 additions and 30 deletions
+24 -11
View File
@@ -1,6 +1,6 @@
Citizen.CreateThread(function()
SetMapName('San Andreas')
SetGameType('Roleplay')
SetGameType('ESX Roleplay')
end)
RegisterNetEvent('esx:onPlayerJoined')
@@ -10,13 +10,23 @@ AddEventHandler('esx:onPlayerJoined', function()
end
end)
if Config.UseMulticharacter then
AddEventHandler("esx:overwriteIdentifierMethod",function(ref)
ESX.GetPlayerIdentifier = ref
end)
end
function onPlayerJoined(playerId)
local identifier
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
if Config.UseMulticharacter then
local identifier = ESX.GetPlayerIdentifier(playerId)
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
end
@@ -63,13 +73,17 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
local playerId, identifier = source
Citizen.Wait(100)
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
if Config.UseMulticharacter then
local identifier = ESX.GetPlayerIdentifier(playerId)
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
end
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 Rockstar account.\n\nYour Rockstar identifier: %s'):format(identifier))
@@ -81,7 +95,6 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
end
end)
function loadESXPlayer(identifier, playerId)
local tasks = {}