mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
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:
+17
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user