mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
feat(settings): notification position
This commit is contained in:
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Otevřít kruhové menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Sprache ändern",
|
||||
"locale_description": "Aktuelle Sprache: ${language} (%s)",
|
||||
"notification_audio": "Benachrichtigungs-Sound"
|
||||
"notification_audio": "Benachrichtigungs-Sound",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Radial Menu öffnen",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Ava rullikmenüü",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Pakeisti kalbą",
|
||||
"locale_description": "Dabartinė: ${language} (%s)",
|
||||
"notification_audio": "Pranešimo garsas"
|
||||
"notification_audio": "Pranešimo garsas",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Atidaryti radialinį meniu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Åpne radial menyen",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -8,7 +8,18 @@
|
||||
"settings": {
|
||||
"locale": "Change locale",
|
||||
"locale_description": "Current language: ${language} (%s)",
|
||||
"notification_audio": "Notification audio"
|
||||
"notification_audio": "Notification audio",
|
||||
"notification_position": "Notification position"
|
||||
},
|
||||
"position": {
|
||||
"bottom": "Bottom",
|
||||
"bottom-left": "Bottom-left",
|
||||
"bottom-right": "Bottom-right",
|
||||
"center-left": "Center-left",
|
||||
"center-right": "Center-right",
|
||||
"top": "Top",
|
||||
"top-left": "Top-left",
|
||||
"top-right": "Top-right"
|
||||
}
|
||||
},
|
||||
"open_radial_menu": "Open radial menu",
|
||||
|
||||
@@ -24,6 +24,7 @@ local settings = require 'resource.settings'
|
||||
function lib.notify(data)
|
||||
local sound = settings.notification_audio and data.sound
|
||||
data.sound = nil
|
||||
data.position = data.position or settings.notification_position
|
||||
|
||||
SendNUIMessage({
|
||||
action = 'notify',
|
||||
|
||||
@@ -11,9 +11,6 @@ function lib.getLocaleKey() return settings.locale end
|
||||
|
||||
---@param key string
|
||||
function lib.setLocale(key)
|
||||
settings.locale = key
|
||||
|
||||
SetResourceKvp('locale', key)
|
||||
TriggerEvent('ox_lib:setLocale', key)
|
||||
SendNUIMessage({
|
||||
action = 'setLocale',
|
||||
|
||||
@@ -1,8 +1,32 @@
|
||||
local settings = {
|
||||
locale = GetResourceKvpString('locale'),
|
||||
notification_position = GetResourceKvpString('notification_position') or 'top-right',
|
||||
notification_audio = GetResourceKvpInt('notification_audio') == 1
|
||||
}
|
||||
|
||||
local function set(key, value)
|
||||
if settings[key] == value then return false end
|
||||
|
||||
settings[key] = value
|
||||
local valueType = type(value)
|
||||
|
||||
if valueType == 'nil' then
|
||||
DeleteResourceKvp(key)
|
||||
elseif valueType == 'string' then
|
||||
SetResourceKvp(key, value)
|
||||
elseif valueType == 'table' then
|
||||
SetResourceKvp(key, json.encode(value))
|
||||
elseif valueType == 'number' then
|
||||
SetResourceKvpInt(key, value)
|
||||
elseif valueType == 'boolean' then
|
||||
SetResourceKvpInt(key, value and 1 or 0)
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
RegisterCommand('ox_lib', function()
|
||||
local input = lib.inputDialog('Settings', {
|
||||
{
|
||||
@@ -11,23 +35,43 @@ RegisterCommand('ox_lib', function()
|
||||
searchable = true,
|
||||
description = locale('ui.settings.locale_description', settings.locale),
|
||||
options = GlobalState['ox_lib:locales'],
|
||||
default = settings.locale,
|
||||
required = true,
|
||||
icon = 'book',
|
||||
},
|
||||
{
|
||||
type = 'select',
|
||||
label = locale('ui.settings.notification_position'),
|
||||
options = {
|
||||
{ label = locale('ui.position.top-right'), value = 'top-right' },
|
||||
{ label = locale('ui.position.top'), value = 'top' },
|
||||
{ label = locale('ui.position.top-left'), value = 'top-left' },
|
||||
{ label = locale('ui.position.center-right'), value = 'center-right' },
|
||||
{ label = locale('ui.position.center-left'), value = 'center-left' },
|
||||
{ label = locale('ui.position.bottom-right'), value = 'bottom-right' },
|
||||
{ label = locale('ui.position.bottom'), value = 'bottom' },
|
||||
{ label = locale('ui.position.bottom-left'), value = 'bottom-left' },
|
||||
},
|
||||
default = settings.notification_position,
|
||||
required = true,
|
||||
icon = 'message',
|
||||
},
|
||||
{
|
||||
type = 'checkbox',
|
||||
label = locale('ui.settings.notification_audio'),
|
||||
checked = settings.notification_audio,
|
||||
}
|
||||
}) --[[@as any]]
|
||||
}) --[[@as table?]]
|
||||
|
||||
if not input then return end
|
||||
|
||||
if input[1] then lib.setLocale(input[1]) end
|
||||
---@type string, string, boolean
|
||||
local locale, notification_position, notification_audio = table.unpack(input)
|
||||
|
||||
if input[2] ~= nil then
|
||||
settings.notification_audio = input[2]
|
||||
SetResourceKvpInt('notification_audio', input[2] and 1 or 0)
|
||||
end
|
||||
if set('locale', locale) then lib.setLocale(locale) end
|
||||
|
||||
set('notification_position', notification_position)
|
||||
set('notification_audio', notification_audio)
|
||||
end)
|
||||
|
||||
return settings
|
||||
|
||||
Reference in New Issue
Block a user