From 4d953bb4bb9ce07e675bd75b39489165eabb3997 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Wed, 20 Jun 2018 21:46:51 +0200 Subject: [PATCH] Implemented cancel event confirmation, closes #5 --- __resource.lua | 2 +- client/main.lua | 51 ++++++++++++++++++++----------------------------- locales/br.lua | 5 +++-- locales/de.lua | 5 +++-- locales/en.lua | 5 +++-- locales/fi.lua | 5 +++-- locales/fr.lua | 5 +++-- locales/sv.lua | 3 +++ 8 files changed, 40 insertions(+), 41 deletions(-) diff --git a/__resource.lua b/__resource.lua index 8f15daa4..7faa13a7 100644 --- a/__resource.lua +++ b/__resource.lua @@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'ESX Skin' -version '1.0.2' +version '1.1.0' server_scripts { '@mysql-async/lib/MySQL.lua', diff --git a/client/main.lua b/client/main.lua index d6c88ec3..845003b0 100644 --- a/client/main.lua +++ b/client/main.lua @@ -101,22 +101,27 @@ function OpenMenu(submitCb, cancelCb, restrict) submitCb(data, menu) DeleteSkinCam() - end, - function(data, menu) - - menu.close() - - DeleteSkinCam() - - TriggerEvent('skinchanger:loadSkin', LastSkin) - - if cancelCb ~= nil then - cancelCb(data, menu) - end - - end, - function(data, menu) + end, function(data, menu) + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'confirm_escape', { + title = _U('confirm_escape'), + align = 'bottom-right', + elements = { + {label = _U('no'), value = 'no'}, + {label = _U('yes'), value = 'yes'} + } + }, function(data2, menu2) + if data2.current.value == 'yes' then + menu.close() + DeleteSkinCam() + TriggerEvent('skinchanger:loadSkin', LastSkin) + end + menu2.close() + end) + if cancelCb ~= nil then + cancelCb(data, menu) + end + end,function(data, menu) TriggerEvent('skinchanger:getSkin', function(skin) zoomOffset = data.current.zoomOffset @@ -345,18 +350,4 @@ AddEventHandler('esx_skin:requestSaveSkin', function() TriggerEvent('skinchanger:getSkin', function(skin) TriggerServerEvent('esx_skin:responseSaveSkin', skin) end) -end) - -Citizen.CreateThread(function() - while true do - - Citizen.Wait(0) - - local playerPed = GetPlayerPed(-1) - - if IsEntityDead(playerPed) then - HasLoadedModel = false - end - - end -end) +end) \ No newline at end of file diff --git a/locales/br.lua b/locales/br.lua index 1716b1f1..52eb7d1c 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -1,8 +1,9 @@ Locales['br'] = { - ['skin_menu'] = 'Skin Menu', ['use_rotate_view'] = 'Use ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ e ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ para girar a visão.', ['skin'] = 'Trocar', ['saveskin'] = 'Salvar', - + ['confirm_escape'] = 'do you want to cancel the skin changer? All changes go unsaved.', + ['no'] = 'no', + ['yes'] = 'yes', } diff --git a/locales/de.lua b/locales/de.lua index d8d43483..25bc1c4f 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,8 +1,9 @@ Locales['de'] = { - ['skin_menu'] = 'Skin Menü', ['use_rotate_view'] = 'benutze ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ und ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ um die Sicht zu drehen.', ['skin'] = 'Skin ändern', ['saveskin'] = 'Skin speichern', - + ['confirm_escape'] = 'do you want to cancel the skin changer? All changes go unsaved.', + ['no'] = 'no', + ['yes'] = 'yes', } diff --git a/locales/en.lua b/locales/en.lua index 99d37d86..1fb10930 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,8 +1,9 @@ Locales['en'] = { - ['skin_menu'] = 'Skin Menu', ['use_rotate_view'] = 'use ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ and ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ to rotate the view.', ['skin'] = 'change skin', ['saveskin'] = 'save skin to a file', - + ['confirm_escape'] = 'do you want to cancel the skin changer? All changes go unsaved.', + ['no'] = 'no', + ['yes'] = 'yes', } diff --git a/locales/fi.lua b/locales/fi.lua index e8a135b6..1ea163a5 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -1,8 +1,9 @@ Locales['fi'] = { - ['skin_menu'] = 'ulkonäkö', ['use_rotate_view'] = 'paina ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ tai ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ liikutaaksesi kameraa.', ['skin'] = 'vaihda ulkonäköä', ['saveskin'] = 'talleta ulkonäkö tiedostoon', - + ['confirm_escape'] = 'do you want to cancel the skin changer? All changes go unsaved.', + ['no'] = 'no', + ['yes'] = 'yes', } diff --git a/locales/fr.lua b/locales/fr.lua index d8f1f20b..c71b7723 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,8 +1,9 @@ Locales['fr'] = { - ['skin_menu'] = 'Skin Menu', ['use_rotate_view'] = 'utilisez ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ et ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ pour tourner la vue.', ['skin'] = 'changer de skin', ['saveskin'] = 'sauvegarder skin dans un fichier', - + ['confirm_escape'] = 'do you want to cancel the skin changer? All changes go unsaved.', + ['no'] = 'no', + ['yes'] = 'yes', } diff --git a/locales/sv.lua b/locales/sv.lua index 02ddd5f0..8f3dfcf8 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -3,4 +3,7 @@ Locales['sv'] = { ['use_rotate_view'] = 'använd ~INPUT_VEH_FLY_ROLL_LEFT_ONLY~ och ~INPUT_VEH_FLY_ROLL_RIGHT_ONLY~ för att rotera.', ['skin'] = 'ändra skin', ['saveskin'] = 'spara skin till fil', + ['confirm_escape'] = 'vill du avbryta menyn? Alla ändringar går osparade.', + ['no'] = 'nej', + ['yes'] = 'ja', }