Support for ESX Legacy 1.3.3

* improvement(server/main): Moved registration event handler out of ESX (support for 1.3.3)

* refactor(server/main): Increase allowed length for charid to 2

* Update fxmanifest.lua
This commit is contained in:
Linden
2021-06-24 02:12:48 +10:00
committed by GitHub
parent e3d1fe611a
commit 7ff0efea21
2 changed files with 18 additions and 4 deletions
+17 -3
View File
@@ -93,20 +93,34 @@ if ESX.GetConfig().Multichar == true then
SetupCharacters(source)
end)
local awaitingRegistration = {}
RegisterServerEvent("esx_multicharacter:CharacterChosen")
AddEventHandler('esx_multicharacter:CharacterChosen', function(charid, isNew)
local src = source
if type(charid) == 'number' and string.len(charid) == 1 and type(isNew) == 'boolean' then
TriggerEvent('esx:onPlayerJoined', src, Config.Prefix..charid, isNew)
if type(charid) == 'number' and string.len(charid) <= 2 and type(isNew) == 'boolean' then
if isNew then
awaitingRegistration[src] = charid
else
TriggerEvent('esx:onPlayerJoined', src, Config.Prefix..charid)
end
else
-- Trigger Ban Event here to ban individuals trying to use SQL Injections
end
end)
AddEventHandler('esx_identity:completedRegistration', function(playerId, data)
TriggerEvent('esx:onPlayerJoined', playerId, Config.Prefix..awaitingRegistration[playerId], data)
awaitingRegistration[playerId] = nil
end)
AddEventHandler('playerDropped', function(reason)
awaitingRegistration[source] = nil
end)
RegisterServerEvent("esx_multicharacter:DeleteCharacter")
AddEventHandler('esx_multicharacter:DeleteCharacter', function(charid)
local src = source
if type(charid) == "number" and string.len(charid) == 1 then
if type(charid) == "number" and string.len(charid) <= 2 then
DeleteCharacter(src, charid)
SetupCharacters(src)
else