Merge pull request #748 from esx-framework/tony-stark-17-patch-1

fix: Fixed notification issue when xPlayer is nil
This commit is contained in:
P Gergő
2022-12-16 11:52:38 +01:00
committed by GitHub
+21 -23
View File
@@ -373,29 +373,27 @@ else
ESX.RegisterServerCallback('esx_identity:registerIdentity', function(source, cb, data) ESX.RegisterServerCallback('esx_identity:registerIdentity', function(source, cb, data)
local xPlayer = ESX.GetPlayerFromId(source) local xPlayer = ESX.GetPlayerFromId(source)
if not checkNameFormat(data.firstname) then
if not checkNameFormat(data.firstname) then TriggerClientEvent('esx:showNotification',source,(TranslateCap('invalid_firstname_format'), "error")
xPlayer.showNotification(TranslateCap('invalid_firstname_format'), "error") return cb(false)
return cb(false) end
end if not checkNameFormat(data.lastname) then
if not checkNameFormat(data.lastname) then TriggerClientEvent('esx:showNotification',source,TranslateCap('invalid_lastname_format'), "error")
xPlayer.showNotification(TranslateCap('invalid_lastname_format'), "error") return cb(false)
return cb(false) end
end if not checkSexFormat(data.sex) then
if not checkSexFormat(data.sex) then TriggerClientEvent('esx:showNotification',source,TranslateCap('invalid_sex_format'), "error")
xPlayer.showNotification(TranslateCap('invalid_sex_format'), "error") return cb(false)
return cb(false) end
end if not checkDOBFormat(data.dateofbirth) then
if not checkDOBFormat(data.dateofbirth) then TriggerClientEvent('esx:showNotification',source,TranslateCap('invalid_dob_format'), "error")
xPlayer.showNotification(TranslateCap('invalid_dob_format'), "error") return cb(false)
return cb(false) end
end if not checkHeightFormat(data.height) then
if not checkHeightFormat(data.height) then TriggerClientEvent('esx:showNotification',source,TranslateCap('invalid_height_format'), "error")
xPlayer.showNotification(TranslateCap('invalid_height_format'), "error") return cb(false)
return cb(false) end
end if xPlayer then
if xPlayer then
if alreadyRegistered[xPlayer.identifier] then if alreadyRegistered[xPlayer.identifier] then
xPlayer.showNotification(TranslateCap('already_registered'), "error") xPlayer.showNotification(TranslateCap('already_registered'), "error")
return cb(false) return cb(false)