fix: Moved checks to if xPlayer isn't nil

This commit is contained in:
Tony Stark
2022-12-16 09:21:19 +05:30
committed by GitHub
parent 684752c8ae
commit 44a0021b7b
+20 -22
View File
@@ -373,29 +373,27 @@ else
ESX.RegisterServerCallback('esx_identity:registerIdentity', function(source, cb, data)
local xPlayer = ESX.GetPlayerFromId(source)
if not checkNameFormat(data.firstname) then
xPlayer.showNotification(TranslateCap('invalid_firstname_format'), "error")
return cb(false)
end
if not checkNameFormat(data.lastname) then
xPlayer.showNotification(TranslateCap('invalid_lastname_format'), "error")
return cb(false)
end
if not checkSexFormat(data.sex) then
xPlayer.showNotification(TranslateCap('invalid_sex_format'), "error")
return cb(false)
end
if not checkDOBFormat(data.dateofbirth) then
xPlayer.showNotification(TranslateCap('invalid_dob_format'), "error")
return cb(false)
end
if not checkHeightFormat(data.height) then
xPlayer.showNotification(TranslateCap('invalid_height_format'), "error")
return cb(false)
end
if xPlayer then
if not checkNameFormat(data.firstname) then
xPlayer.showNotification(TranslateCap('invalid_firstname_format'), "error")
return cb(false)
end
if not checkNameFormat(data.lastname) then
xPlayer.showNotification(TranslateCap('invalid_lastname_format'), "error")
return cb(false)
end
if not checkSexFormat(data.sex) then
xPlayer.showNotification(TranslateCap('invalid_sex_format'), "error")
return cb(false)
end
if not checkDOBFormat(data.dateofbirth) then
xPlayer.showNotification(TranslateCap('invalid_dob_format'), "error")
return cb(false)
end
if not checkHeightFormat(data.height) then
xPlayer.showNotification(TranslateCap('invalid_height_format'), "error")
return cb(false)
end
if alreadyRegistered[xPlayer.identifier] then
xPlayer.showNotification(TranslateCap('already_registered'), "error")
return cb(false)