29 files changed
+122
-45
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ server_scripts {
|
|||||||
'@oxmysql/lib/MySQL.lua',
|
'@oxmysql/lib/MySQL.lua',
|
||||||
'settings/serverConfig.lua',
|
'settings/serverConfig.lua',
|
||||||
'modules/locales/shared.lua',
|
'modules/locales/shared.lua',
|
||||||
'modules/utility/server/*.lua',
|
'modules/version/server/*.lua',
|
||||||
'modules/framework/**/server.lua',
|
'modules/framework/**/server.lua',
|
||||||
'modules/inventory/**/server.lua',
|
'modules/inventory/**/server.lua',
|
||||||
'modules/doorlock/**/server.lua',
|
'modules/doorlock/**/server.lua',
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ if not IsDuplicityVersion() then goto client end
|
|||||||
Bridge.RegisterModule("SQL", cLib.SQL)
|
Bridge.RegisterModule("SQL", cLib.SQL)
|
||||||
Bridge.RegisterModule("Logs", cLib.Logs)
|
Bridge.RegisterModule("Logs", cLib.Logs)
|
||||||
Bridge.RegisterModule("LootTables", cLib.LootTables)
|
Bridge.RegisterModule("LootTables", cLib.LootTables)
|
||||||
|
Bridge.RegisterModule("Version", Version)
|
||||||
|
|
||||||
|
|
||||||
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
|
-- ▄▀▀ █ █ ██▀ █▄ █ ▀█▀
|
||||||
@@ -101,6 +102,7 @@ Bridge.RegisterModule("Progressbar", Progressbar)
|
|||||||
Bridge.RegisterModule("Target", Target)
|
Bridge.RegisterModule("Target", Target)
|
||||||
Bridge.RegisterModule("Menu", Menu)
|
Bridge.RegisterModule("Menu", Menu)
|
||||||
Bridge.RegisterModule("Utility", cLib.Utility)
|
Bridge.RegisterModule("Utility", cLib.Utility)
|
||||||
|
|
||||||
Bridge.RegisterModule("Placeable", cLib.Placeable)
|
Bridge.RegisterModule("Placeable", cLib.Placeable)
|
||||||
--new
|
--new
|
||||||
Bridge.RegisterModule("Gizmo", cLib.Gizmo)
|
Bridge.RegisterModule("Gizmo", cLib.Gizmo)
|
||||||
|
|||||||
+7
-1
@@ -5,5 +5,11 @@
|
|||||||
"place_object_scroll_up": "[SCROLL UP] Turn right \n",
|
"place_object_scroll_up": "[SCROLL UP] Turn right \n",
|
||||||
"place_object_scroll_down": "[SCROLL DOWN] Turn left",
|
"place_object_scroll_down": "[SCROLL DOWN] Turn left",
|
||||||
"enter_text": "Enter Text",
|
"enter_text": "Enter Text",
|
||||||
"no_prop_defined": "You didnt define any object to place"
|
"no_prop_defined": "You didnt define any object to place",
|
||||||
|
"UNITTEST": {
|
||||||
|
"UNITTESTA": "Im a %s %s",
|
||||||
|
"UNITTEST": {
|
||||||
|
"UNITTESTA": "\n.-._ _,-,\n`._`-._ _,-'_,'\n `._ `-._ _,-' _,'\n `._ `-._ __.-----.__ _,-' _,'\n `._ `#===\\\"\\\"\\\" \\\"\\\"\\\"===#' _,'\n `._/) ._ _. (\\_,'\n )*' **.__ __.** '*(\n # .==..__ \\\"\\\" \\\"\\\" __..==, #\n # `\\\"._(_). .(_)_.\\\"' #"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,11 @@ Framework.GetPlayerJob = function()
|
|||||||
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
|
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Framework.HasItem = function(item)
|
||||||
|
local hasItem = ESX.SearchInventory(item, true)
|
||||||
|
return hasItem > 0 and true or false
|
||||||
|
end
|
||||||
|
|
||||||
Framework.GetPlayerInventory = function()
|
Framework.GetPlayerInventory = function()
|
||||||
return ESX.GetPlayerData().inventory
|
return ESX.GetPlayerData().inventory
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ Framework.GetPlayerJob = function()
|
|||||||
return group, title, title, grade
|
return group, title, title, grade
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Framework.HasItem = function()
|
||||||
|
local itemCount = ox_inventory:Search('count', item)
|
||||||
|
local hasItem = itemCount ~= 0
|
||||||
|
return hasItem
|
||||||
|
end
|
||||||
|
|
||||||
Framework.GetPlayerInventory = function()
|
Framework.GetPlayerInventory = function()
|
||||||
return exports.ox_inventory:GetPlayerItems()
|
return exports.ox_inventory:GetPlayerItems()
|
||||||
end
|
end
|
||||||
@@ -55,4 +61,4 @@ RegisterNetEvent('ox:setGroup', function(name, grade)
|
|||||||
PlayerJobGradeName = grade
|
PlayerJobGradeName = grade
|
||||||
PlayerJobGradeLevel = grade
|
PlayerJobGradeLevel = grade
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate',PlayerJobName, PlayerJobLabel, PlayerJobGradeName, PlayerJobGradeLevel)
|
TriggerEvent('community_bridge:Client:OnPlayerJobUpdate',PlayerJobName, PlayerJobLabel, PlayerJobGradeName, PlayerJobGradeLevel)
|
||||||
end)
|
end)
|
||||||
@@ -57,6 +57,10 @@ Framework.GetPlayerJob = function()
|
|||||||
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Framework.HasItem = function(item)
|
||||||
|
return QBCore.Functions.HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Framework.GetPlayerInventory = function()
|
Framework.GetPlayerInventory = function()
|
||||||
local items = {}
|
local items = {}
|
||||||
local frameworkInv = QBCore.Functions.GetPlayerData().items
|
local frameworkInv = QBCore.Functions.GetPlayerData().items
|
||||||
@@ -109,4 +113,4 @@ RegisterNetEvent('QBCore:Client:OnGangUpdate', function(data)
|
|||||||
PlayerJobGradeLevel = data.grade.level
|
PlayerJobGradeLevel = data.grade.level
|
||||||
TriggerEvent('community_bridge:Client:OnPlayerGangUpdate', PlayerGangName, PlayerGangLabel, PlayerGangGradeName, PlayerGangGradeLevel)
|
TriggerEvent('community_bridge:Client:OnPlayerGangUpdate', PlayerGangName, PlayerGangLabel, PlayerGangGradeName, PlayerGangGradeLevel)
|
||||||
--]]
|
--]]
|
||||||
end)
|
end)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('BigDaddy-Fuel') ~= 'started' then return end
|
if GetResourceState('BigDaddy-Fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('LegacyFuel') ~= 'started' then return end
|
if GetResourceState('LegacyFuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('Renewed-Fuel') ~= 'started' then return end
|
if GetResourceState('Renewed-Fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('cdn-fuel') ~= 'started' then return end
|
if GetResourceState('cdn-fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('esx-sna-fuel') ~= 'started' then return end
|
if GetResourceState('esx-sna-fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('okokGasStation') ~= 'started' then return end
|
if GetResourceState('okokGasStation') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('cdn-fuel') ~= 'started' then return end
|
if GetResourceState('cdn-fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('ps-fuel') ~= 'started' then return end
|
if GetResourceState('ps-fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
if GetResourceState('qs-fuelstations') ~= 'started' then return end
|
if GetResourceState('qs-fuelstations') ~= 'started' then return end
|
||||||
|
Fuel = Fuel or {}
|
||||||
Fuel = {}
|
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0 end
|
if not DoesEntityExist(vehicle) then return 0.0 end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('ti_fuel') ~= 'started' then return end
|
if GetResourceState('ti_fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0, type end
|
if not DoesEntityExist(vehicle) then return 0.0, type end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if GetResourceState('x-fuel') ~= 'started' then return end
|
if GetResourceState('x-fuel') ~= 'started' then return end
|
||||||
Fuel = {}
|
Fuel = Fuel or {}
|
||||||
|
|
||||||
Fuel.GetFuel = function(vehicle)
|
Fuel.GetFuel = function(vehicle)
|
||||||
if not DoesEntityExist(vehicle) then return 0.0, type end
|
if not DoesEntityExist(vehicle) then return 0.0, type end
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return Framework.GetItemInfo(item)
|
return Framework.GetItemInfo(item)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return Framework.HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
return "https://avatars.githubusercontent.com/u/47620135"
|
return "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
@@ -38,4 +38,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
if GetResourceState('jpr-inventory') ~= 'started' then return end
|
if GetResourceState('jpr-inventory') ~= 'started' then return end
|
||||||
|
|
||||||
|
local jpr = exports['jpr-inventory']
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, data)
|
RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id, data)
|
||||||
@@ -8,8 +9,12 @@ RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id,
|
|||||||
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return jpr:HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item))
|
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
@@ -17,6 +17,10 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return repackedTable or {}
|
return repackedTable or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return origin:HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item))
|
local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
|
||||||
@@ -39,4 +43,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
@@ -17,6 +17,12 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
local itemCount = ox_inventory:Search('count', item)
|
||||||
|
local hasItem = itemCount ~= 0
|
||||||
|
return hasItem
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item))
|
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
|
local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
|
||||||
@@ -27,4 +33,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
return exports.ox_inventory:GetPlayerItems()
|
return exports.ox_inventory:GetPlayerItems()
|
||||||
end
|
end
|
||||||
|
|
||||||
--Bridge.RegisterModule("Inventory", Inventory)
|
--Bridge.RegisterModule("Inventory", Inventory)
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
if GetResourceState('ps-inventory') ~= 'started' then return end
|
if GetResourceState('ps-inventory') ~= 'started' then return end
|
||||||
|
|
||||||
|
local ps = exports['ps-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data)
|
RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id, data)
|
||||||
@@ -8,8 +10,12 @@ RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id,
|
|||||||
TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return ps:HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item))
|
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
if GetResourceState('qb-inventory') ~= 'started' then return end
|
if GetResourceState('qb-inventory') ~= 'started' then return end
|
||||||
|
|
||||||
|
local qb = exports['qb-inventory']
|
||||||
|
|
||||||
Inventory = Inventory or {}
|
Inventory = Inventory or {}
|
||||||
|
|
||||||
RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data)
|
RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id, data)
|
||||||
@@ -8,8 +10,12 @@ RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id,
|
|||||||
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return qb:HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
|
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
|
||||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||||
end
|
end
|
||||||
@@ -21,6 +21,11 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
local check = quasar:Search(item)
|
||||||
|
return check and true or false
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item))
|
local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item))
|
||||||
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
|
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ Inventory.GetItemInfo = function(item)
|
|||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Inventory.HasItem = function(item)
|
||||||
|
return tgiann:HasItem(item)
|
||||||
|
end
|
||||||
|
|
||||||
Inventory.GetImagePath = function(item)
|
Inventory.GetImagePath = function(item)
|
||||||
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item))
|
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item))
|
||||||
local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))
|
local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))
|
||||||
@@ -44,4 +48,4 @@ Inventory.GetPlayerInventory = function()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
+31
-15
@@ -19,41 +19,57 @@ Language = {}
|
|||||||
function Language.Locale(str, ...)
|
function Language.Locale(str, ...)
|
||||||
local resource = GetInvokingResource() or GetCurrentResourceName()
|
local resource = GetInvokingResource() or GetCurrentResourceName()
|
||||||
assert(resource, "Resource name not found")
|
assert(resource, "Resource name not found")
|
||||||
--print(resource, "locales/" .. Lang .. ".json")
|
|
||||||
local locales = LoadResourceFile(resource, "locales/" .. Lang .. ".json")
|
local locales = LoadResourceFile(resource, "locales/" .. Lang .. ".json")
|
||||||
--print(locales, Lang)
|
|
||||||
locales = locales and json.decode(locales) or {}
|
locales = locales and json.decode(locales) or {}
|
||||||
local locale = locales[str]
|
|
||||||
|
|
||||||
if not locale then
|
-- Handle nested tables via dot notation
|
||||||
warn("Locale not found for language: " .. Lang)
|
local current = locales
|
||||||
return str
|
for part in str:gmatch("[^%.]+") do
|
||||||
end
|
if type(current) ~= "table" then
|
||||||
|
warn(("Invalid nested locale path: %s"):format(str))
|
||||||
local args = {...}
|
return str
|
||||||
if #args > 0 then
|
end
|
||||||
for i = 1, #args do
|
current = current[part]
|
||||||
locale = locale:gsub('{' .. i .. '}', args[i])
|
if not current then
|
||||||
|
warn(("Locale not found for key: %s in language: %s"):format(str, Lang))
|
||||||
|
return str
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return locale
|
-- Handle variable replacement
|
||||||
|
local args = {...}
|
||||||
|
|
||||||
|
if type(current) == "string" and #args > 0 then
|
||||||
|
current = string.format(current, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return current
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if BridgeSharedConfig.DebugLevel == 2 then
|
if BridgeSharedConfig.DebugLevel == 2 then
|
||||||
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
|
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
|
||||||
-- whatever.Locales("some-index-in-language-.json-file")
|
-- whatever.Locales("some-index-in-language-.json-file")
|
||||||
-- Files must be stored in "locales" folder, within the resource.
|
-- Files must be stored in "locales" folder, within the resource.
|
||||||
-- Instead of using Require you can also import it via the manifest.
|
-- Instead of using Require you can also import it via the manifest.
|
||||||
-- The Lang variable is available globally, which tells you what the server is using.
|
-- The Lang variable is available globally, which tells you what the server is using.
|
||||||
--print("Language: ", Lang)
|
-- print("Language: ", Lang)
|
||||||
--print("Locale: ", Language.Locale("locale-unit-test"))
|
-- print("Locale: ", Language.Locale("locale-unit-test"))
|
||||||
|
|
||||||
-- Example outside community bridge resource:
|
-- Example outside community bridge resource:
|
||||||
|
|
||||||
-- local Language = Require('modules/locales/shared.lua')
|
-- local Language = Require('modules/locales/shared.lua')
|
||||||
-- print("Language: ", Lang)
|
-- print("Language: ", Lang)
|
||||||
-- print("Locale: ", Language.Locale("locale-unit-test"))
|
-- print("Locale: ", Language.Locale("locale-unit-test"))
|
||||||
|
RegisterCommand("lang", function(source, args, raw)
|
||||||
|
print(Language.Locale("UNITTEST.UNITTEST.UNITTESTA"))
|
||||||
|
print(Language.Locale("UNITTEST.UNITTESTA", "Devil", "GERRRRRRR!"))
|
||||||
|
|
||||||
|
print( "Oh also this works", Language.Locale("place_object_scroll_down"))
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Language
|
return Language
|
||||||
@@ -7,7 +7,6 @@ Menu = {}
|
|||||||
---@return id string The menu ID.
|
---@return id string The menu ID.
|
||||||
function Menu.Open(data, useQb)
|
function Menu.Open(data, useQb)
|
||||||
local id = data.id or Ids.CreateUniqueId(Menus, nil, nil)
|
local id = data.id or Ids.CreateUniqueId(Menus, nil, nil)
|
||||||
local menuExists = Menus[id]
|
|
||||||
Menus[id] = OpenMenu(id, data, useQb)
|
Menus[id] = OpenMenu(id, data, useQb)
|
||||||
data.id = id
|
data.id = id
|
||||||
return id
|
return id
|
||||||
@@ -20,8 +19,8 @@ RegisterNetEvent('community_bridge:client:MenuCallback', function(_args)
|
|||||||
local id = _args.id
|
local id = _args.id
|
||||||
local onSelect = _args.onSelect
|
local onSelect = _args.onSelect
|
||||||
local args = _args.args
|
local args = _args.args
|
||||||
if not Menus[id] then return end
|
Menus[id] = nil
|
||||||
onSelect({number=_args.selected}, false, args)
|
onSelect(args)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
Utility = Utility or {}
|
Version = Version or {}
|
||||||
|
|
||||||
function Utility.VersionChecker(repoPath)
|
function Version.VersionChecker(repoPath)
|
||||||
local resource = repoPath:match("([^/]+)$")
|
local resource = repoPath:match("([^/]+)$")
|
||||||
if not resource then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end
|
if not resource then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end
|
||||||
|
|
||||||
@@ -34,5 +34,5 @@ end
|
|||||||
|
|
||||||
AddEventHandler('onResourceStart', function(resourceName)
|
AddEventHandler('onResourceStart', function(resourceName)
|
||||||
if GetCurrentResourceName() ~= resourceName then return end
|
if GetCurrentResourceName() ~= resourceName then return end
|
||||||
Utility.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge")
|
Version.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge")
|
||||||
end)
|
end)
|
||||||
Reference in new issue
Block a user