Skip to content

Commit

Permalink
feat: Confirm to delete character (#188)
Browse files Browse the repository at this point in the history
* feat: Confirm to delete character

* refactor: inline if for confirm delete alert
  • Loading branch information
tom-osborne committed Oct 6, 2023
1 parent ef4e19c commit 4d70bf3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 12 additions & 3 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,18 @@ local function chooseCharacter()
description = Lang:t('info.delete_character_description', { playerName = name }),
icon = 'trash',
onSelect = function()
TriggerServerEvent('qbx_core:server:deleteCharacter', character.citizenid)
destroyPreviewCam()
chooseCharacter()
if lib.alertDialog({
header = Lang:t('info.delete_character'),
content = Lang:t('info.confirm_delete'),
centered = true,
cancel = true
}) then
TriggerServerEvent('qbx_core:server:deleteCharacter', character.citizenid)
destroyPreviewCam()
chooseCharacter()
else
lib.showContext('qbx_core_multichar_character_'..i)
end
end
} or nil
}
Expand Down
3 changes: 2 additions & 1 deletion locale/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ local Translations = {
nationality = 'Nationality',
gender = 'Sex',
birth_date = 'Birth Date',
select_gender = 'Select your gender...'
select_gender = 'Select your gender...',
confirm_delete = 'Are you sure you wish to delete this character?'
},
command = {
tp = {
Expand Down

0 comments on commit 4d70bf3

Please sign in to comment.