Skip to content

Commit

Permalink
chore: esx_identity updated to version 1.0.1 + Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Feb 29, 2024
1 parent 4d8a3b7 commit 3e69375
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion server-data/resources/[esx]/esx_identity/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if not Config.UseDeferrals then
return
end

ESX.ShowNotification(_U("thank_you_for_registering"))
ESX.ShowNotification(TranslateCap("thank_you_for_registering"))
setGuiState(false)

if not ESX.GetConfig().Multichar then
Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[esx]/esx_identity/config.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Config = {}
Config.Locale = "en"
Config.Locale = GetConvar("esx:locale", "en")

-- [Config.EnableCommands]
-- Enables Commands Such As /char and /chardel
Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[esx]/esx_identity/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fx_version("adamant")
game("gta5")
description("ESX Identity")
lua54("yes")
version("1.0.0")
version("1.0.1")

shared_scripts({
"@es_extended/imports.lua",
Expand Down
94 changes: 47 additions & 47 deletions server-data/resources/[esx]/esx_identity/server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ local function checkDOBFormat(str)
if ((d <= 0) or (d > 31)) or ((m <= 0) or (m > 12)) or ((y <= Config.LowestYear) or (y > Config.HighestYear)) then
return false
elseif m == 4 or m == 6 or m == 9 or m == 11 then
return d < 30
return d <= 30
elseif m == 2 then
if y % 400 == 0 or (y % 100 ~= 0 and y % 4 == 0) then
return d < 29
return d <= 29
else
return d < 28
return d <= 28
end
else
return d < 31
return d <= 31
end
end

Expand Down Expand Up @@ -166,7 +166,7 @@ if Config.UseDeferrals then
or data.sex == ""
or data.height == ""
then
deferrals.done(_U("data_incorrect"))
deferrals.done(TranslateCap("data_incorrect"))
else
if
checkNameFormat(data.firstname)
Expand All @@ -186,7 +186,7 @@ if Config.UseDeferrals then

deferrals.done()
else
deferrals.done(_U("invalid_format"))
deferrals.done(TranslateCap("invalid_format"))
end
end
end
Expand All @@ -211,22 +211,22 @@ if Config.UseDeferrals then
or data.sex == ""
or data.height == ""
then
return deferrals.done(_U("data_incorrect"))
return deferrals.done(TranslateCap("data_incorrect"))
end
if not checkNameFormat(data.firstname) then
return deferrals.done(_U("invalid_firstname_format"))
return deferrals.done(TranslateCap("invalid_firstname_format"))
end
if not checkNameFormat(data.lastname) then
return deferrals.done(_U("invalid_lastname_format"))
return deferrals.done(TranslateCap("invalid_lastname_format"))
end
if not checkDOBFormat(data.dateofbirth) then
return deferrals.done(_U("invalid_dob_format"))
return deferrals.done(TranslateCap("invalid_dob_format"))
end
if not checkSexFormat(data.sex) then
return deferrals.done(_U("invalid_sex_format"))
return deferrals.done(TranslateCap("invalid_sex_format"))
end
if not checkHeightFormat(data.height) then
return deferrals.done(_U("invalid_height_format"))
return deferrals.done(TranslateCap("invalid_height_format"))
end

playerIdentity[identifier] = {
Expand All @@ -245,7 +245,7 @@ if Config.UseDeferrals then
end
)
else
deferrals.done(_U("no_identifier"))
deferrals.done(TranslateCap("no_identifier"))
end
end)

Expand Down Expand Up @@ -327,7 +327,7 @@ else
Wait(40)

if not identifier then
return deferrals.done(_U("no_identifier"))
return deferrals.done(TranslateCap("no_identifier"))
end
MySQL.single(
"SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = ?",
Expand Down Expand Up @@ -407,28 +407,28 @@ else
ESX.RegisterServerCallback("esx_identity:registerIdentity", function(source, cb, data)
local xPlayer = ESX.GetPlayerFromId(source)
if not checkNameFormat(data.firstname) then
TriggerClientEvent("esx:showNotification", source, _U("invalid_firstname_format"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_firstname_format"), "error")
return cb(false)
end
if not checkNameFormat(data.lastname) then
TriggerClientEvent("esx:showNotification", source, _U("invalid_lastname_format"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_lastname_format"), "error")
return cb(false)
end
if not checkSexFormat(data.sex) then
TriggerClientEvent("esx:showNotification", source, _U("invalid_sex_format"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_sex_format"), "error")
return cb(false)
end
if not checkDOBFormat(data.dateofbirth) then
TriggerClientEvent("esx:showNotification", source, _U("invalid_dob_format"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_dob_format"), "error")
return cb(false)
end
if not checkHeightFormat(data.height) then
TriggerClientEvent("esx:showNotification", source, _U("invalid_height_format"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("invalid_height_format"), "error")
return cb(false)
end
if xPlayer then
if alreadyRegistered[xPlayer.identifier] then
xPlayer.showNotification(_U("already_registered"), "error")
xPlayer.showNotification(TranslateCap("already_registered"), "error")
return cb(false)
end

Expand Down Expand Up @@ -456,7 +456,7 @@ else
end

if not multichar then
TriggerClientEvent("esx:showNotification", source, _U("data_incorrect"), "error")
TriggerClientEvent("esx:showNotification", source, TranslateCap("data_incorrect"), "error")
return cb(false)
end

Expand Down Expand Up @@ -484,80 +484,80 @@ end
if Config.EnableCommands then
ESX.RegisterCommand("char", "user", function(xPlayer)
if xPlayer and xPlayer.getName() then
xPlayer.showNotification(_U("active_character", xPlayer.getName()))
xPlayer.showNotification(TranslateCap("active_character", xPlayer.getName()))
else
xPlayer.showNotification(_U("error_active_character"))
xPlayer.showNotification(TranslateCap("error_active_character"))
end
end, false, { help = _U("show_active_character") })
end, false, { help = TranslateCap("show_active_character") })

ESX.RegisterCommand("chardel", "user", function(xPlayer)
if xPlayer and xPlayer.getName() then
if Config.UseDeferrals then
xPlayer.kick(_U("deleted_identity"))
xPlayer.kick(TranslateCap("deleted_identity"))
Wait(1500)
deleteIdentity(xPlayer)
xPlayer.showNotification(_U("deleted_character"))
xPlayer.showNotification(TranslateCap("deleted_character"))
playerIdentity[xPlayer.identifier] = nil
alreadyRegistered[xPlayer.identifier] = false
else
deleteIdentity(xPlayer)
xPlayer.showNotification(_U("deleted_character"))
xPlayer.showNotification(TranslateCap("deleted_character"))
playerIdentity[xPlayer.identifier] = nil
alreadyRegistered[xPlayer.identifier] = false
TriggerClientEvent("esx_identity:showRegisterIdentity", xPlayer.source)
end
else
xPlayer.showNotification(_U("error_delete_character"))
xPlayer.showNotification(TranslateCap("error_delete_character"))
end
end, false, { help = _U("delete_character") })
end, false, { help = TranslateCap("delete_character") })
end

if Config.EnableDebugging then
ESX.RegisterCommand("xPlayerGetFirstName", "user", function(xPlayer)
if xPlayer and xPlayer.get("firstName") then
xPlayer.showNotification(_U("return_debug_xPlayer_get_first_name", xPlayer.get("firstName")))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_first_name", xPlayer.get("firstName")))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_first_name"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_first_name"))
end
end, false, { help = _U("debug_xPlayer_get_first_name") })
end, false, { help = TranslateCap("debug_xPlayer_get_first_name") })

ESX.RegisterCommand("xPlayerGetLastName", "user", function(xPlayer)
if xPlayer and xPlayer.get("lastName") then
xPlayer.showNotification(_U("return_debug_xPlayer_get_last_name", xPlayer.get("lastName")))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_last_name", xPlayer.get("lastName")))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_last_name"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_last_name"))
end
end, false, { help = _U("debug_xPlayer_get_last_name") })
end, false, { help = TranslateCap("debug_xPlayer_get_last_name") })

ESX.RegisterCommand("xPlayerGetFullName", "user", function(xPlayer)
if xPlayer and xPlayer.getName() then
xPlayer.showNotification(_U("return_debug_xPlayer_get_full_name", xPlayer.getName()))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_full_name", xPlayer.getName()))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_full_name"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_full_name"))
end
end, false, { help = _U("debug_xPlayer_get_full_name") })
end, false, { help = TranslateCap("debug_xPlayer_get_full_name") })

ESX.RegisterCommand("xPlayerGetSex", "user", function(xPlayer)
if xPlayer and xPlayer.get("sex") then
xPlayer.showNotification(_U("return_debug_xPlayer_get_sex", xPlayer.get("sex")))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_sex", xPlayer.get("sex")))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_sex"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_sex"))
end
end, false, { help = _U("debug_xPlayer_get_sex") })
end, false, { help = TranslateCap("debug_xPlayer_get_sex") })

ESX.RegisterCommand("xPlayerGetDOB", "user", function(xPlayer)
if xPlayer and xPlayer.get("dateofbirth") then
xPlayer.showNotification(_U("return_debug_xPlayer_get_dob", xPlayer.get("dateofbirth")))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_dob", xPlayer.get("dateofbirth")))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_dob"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_dob"))
end
end, false, { help = _U("debug_xPlayer_get_dob") })
end, false, { help = TranslateCap("debug_xPlayer_get_dob") })

ESX.RegisterCommand("xPlayerGetHeight", "user", function(xPlayer)
if xPlayer and xPlayer.get("height") then
xPlayer.showNotification(_U("return_debug_xPlayer_get_height", xPlayer.get("height")))
xPlayer.showNotification(TranslateCap("return_debug_xPlayer_get_height", xPlayer.get("height")))
else
xPlayer.showNotification(_U("error_debug_xPlayer_get_height"))
xPlayer.showNotification(TranslateCap("error_debug_xPlayer_get_height"))
end
end, false, { help = _U("debug_xPlayer_get_height") })
end, false, { help = TranslateCap("debug_xPlayer_get_height") })
end

0 comments on commit 3e69375

Please sign in to comment.