From 9e0935e46ba805dd1a2af9ec7c237e8204b1a833 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 28 Feb 2023 16:47:53 +1100 Subject: [PATCH] refactor: update ox_lib version dependency --- client/main.lua | 5 +++++ locales/en.json | 3 ++- server/main.lua | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/client/main.lua b/client/main.lua index 1a5d6f6f..b23f153d 100644 --- a/client/main.lua +++ b/client/main.lua @@ -2,6 +2,11 @@ if not LoadResourceFile(lib.name, 'web/build/index.html') then error('Unable to load UI. Build ox_doorlock or download the latest release.\n ^3https://github.com/overextended/ox_doorlock/releases/latest/download/ox_doorlock.zip^0') end +do + local success, msg = lib.checkDependency('ox_lib', '3.0.0') + if not success then error(msg) end +end + lib.locale() TriggerServerEvent('ox_doorlock:getDoors') diff --git a/locales/en.json b/locales/en.json index ba32a00c..227a9699 100644 --- a/locales/en.json +++ b/locales/en.json @@ -13,5 +13,6 @@ "cannot_unlock": "Unable to unlock door", "cannot_lock": "Unable to lock door", "create_modify_lock": "Create a doorlock, or modify an existing one", - "add_door_textui": "**Create new door** \nInteract with [LMB] \nCancel with [RMB]" + "add_door_textui": "**Create new door** \nInteract with [LMB] \nCancel with [RMB]", + "command_closest": "Open UI directly to closest doorlock" } diff --git a/server/main.lua b/server/main.lua index 2852369d..3c19dfee 100644 --- a/server/main.lua +++ b/server/main.lua @@ -6,7 +6,7 @@ do local success, msg = lib.checkDependency('oxmysql', '2.4.0') if not success then error(msg) end - success, msg = lib.checkDependency('ox_lib', '2.14.2') + success, msg = lib.checkDependency('ox_lib', '3.0.0') if not success then error(msg) end end @@ -344,7 +344,16 @@ RegisterNetEvent('ox_doorlock:breakLockpick', function() RemoveItem(source, 'lockpick') end) - -lib.addCommand(Config.CommandPrincipal, 'doorlock', function(source, args) +lib.addCommand('doorlock', { + help = locale('create_modify_lock'), + params = { + { + name = 'closest', + help = locale('command_closest'), + optional = true, + }, + }, + restricted = Config.CommandPrincipal +}, function(source, args) TriggerClientEvent('ox_doorlock:triggeredCommand', source, args.closest) -end, {'closest'}, locale('create_modify_lock')) +end)