Skip to content

Commit

Permalink
refactor: update ox_lib version dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
thelindat committed Feb 28, 2023
1 parent 136169d commit 9e0935e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 5 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
17 changes: 13 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

0 comments on commit 9e0935e

Please sign in to comment.