Merge pull request #126 from The-Order-Of-The-Sacred-Framework/dev

Dev
This commit is contained in:
MrNewb authored and GitHub committed 2025-07-09 09:16:41 -04:00
commit a9a4ef619c
64 files changed
+1847 -955

No files matched your search

+5 -3
View File
@@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'
author 'The Order of the Sacred Framework'
name 'community_bridge'
description 'A Universal Bridge for Our Community, created by a group of contributors with a shared vision to enhance both user and developer experiences. This bridge connects various frameworks, inventories, target systems, notification systems, and more, fostering compatibility and seamless integration.'
version '0.9.2'
version '0.10.0'
shared_scripts {
'@ox_lib/init.lua',
@@ -33,6 +33,7 @@ server_scripts {
'modules/notify/**/server.lua',
'modules/housing/**/server.lua',
'modules/skills/**/server.lua',
'modules/bossmenu/**/server.lua',
"lib/**/server.lua",
'init.lua',
}
@@ -52,15 +53,16 @@ client_scripts {
'modules/progressbar/**/client.lua',
'modules/clothing/**/client.lua',
'modules/input/**/client.lua',
'modules/menu/*.lua',
'modules/menu/**/client.lua',
'modules/helptext/**/client.lua',
'modules/notify/**/client.lua',
'modules/dialogue/**/client/*.lua',
'modules/shops/**/client.lua',
'modules/housing/**/client.lua',
'modules/skills/**/client.lua',
'modules/bossmenu/**/client.lua',
'init.lua',
-- 'unit_tests/input_test.lua',
-- 'unit_tests/*.lua',
}
ui_page 'web/dist/index.html'
+1
View File
@@ -46,6 +46,7 @@ end
--Bridge
Bridge.RegisterModule("Framework", Framework)
Bridge.RegisterModule("BossMenu", BossMenu)
Bridge.RegisterModule("Inventory", Inventory)
Bridge.RegisterModule("Notify", Notify)
Bridge.RegisterModule("HelpText", HelpText)
+23
View File
@@ -0,0 +1,23 @@
-- Test file for FiveM Community Bridge Extension
-- Try the following to test extension features:
-- 1. Type "CommunityBridge." (with the dot) and you should see auto-completion
-- CommunityBridge.
-- 2. Type "AddEventHandler" and see parameter hints
-- AddEventHandler(
-- 3. Hover over these function names to see documentation:
-- GetPlayerData, SetPlayerData, TriggerEvent, RegisterNetEvent
-- 4. Try these snippets (type the word and press Tab):
-- event
-- thread
-- command
-- cbget
-- cbset
-- 5. Test signature help - start typing a function call:
-- CommunityBridge.GetPlayerData(
print("Extension test file loaded")
+39 -11
View File
@@ -62,20 +62,35 @@ end
--- Registers an entity received from the server and sets up proximity spawning.
-- @param entityData table Data received from the server via 'community_bridge:client:CreateEntity'
function ClientEntity.Register(entityData)
if Entities[entityData.id] then return end -- Already registered
function ClientEntity.Create(entityData)
entityData.id = entityData.id or Ids.CreateUniqueId(Entities)
if Entities[entityData.id] then return Entities[entityData.id] end -- Already registered
Entities[entityData.id] = entityData
-- print(string.format("[ClientEntity] Registering %s entity %s", entityData.entityType, entityData.id))
-- Use Point system for proximity checks
-- print(string.format("[ClientEntity] Registering entity %s at %s", entityData.id, json.encode(entityData)))
return Point.Register(entityData.id, entityData.coords, entityData.spawnDistance or 50.0, entityData, SpawnEntity, RemoveEntity, function() end)
return Point.Register(entityData.id, entityData.coords, entityData.spawnDistance or 50.0, entityData, SpawnEntity, RemoveEntity, function() end)
end
--Depricated use ClientEntity.Create instead
--- Registers an entity and spawns it in the world if not already spawned.
ClientEntity.Register = ClientEntity.Create
function ClientEntity.CreateBulk(entities)
local registeredEntities = {}
for _, entityData in pairs(entities) do
local entity = ClientEntity.Create(entityData)
registeredEntities[entity.id] = entity
end
return registeredEntities
end
-- Depricated use ClientEntity.CreateBulk instead
ClientEntity.RegisterBulk = ClientEntity.CreateBulk
--- Unregisters an entity and removes it from the world if spawned.
-- @param id string|number The ID of the entity to unregister.
function ClientEntity.Unregister(id)
function ClientEntity.Destroy(id)
local entityData = Entities[id]
if not entityData then return end
@@ -83,6 +98,8 @@ function ClientEntity.Unregister(id)
RemoveEntity(entityData)
Entities[id] = nil
end
ClientEntity.Unregister = ClientEntity.Destroy
--- Updates the data for a registered entity.
-- @param id string|number The ID of the entity to update.
@@ -95,7 +112,6 @@ function ClientEntity.Update(id, data)
local needsPointUpdate = false
for key, value in pairs(data) do
if key == 'coords' and #(entityData.coords - value) > 0.1 then
-- print(string.format("[ClientEntity] Updating coords for entity %s", id))
needsPointUpdate = true
end
if key == 'spawnDistance' and entityData.spawnDistance ~= value then
@@ -153,9 +169,21 @@ function ClientEntity.RegisterAction(name, func)
ClientEntityActions.RegisterAction(name, func)
end
function ClientEntity.OnCreate(_type, func)
ClientEntity.OnCreates = ClientEntity.OnCreates or {}
if not ClientEntity.OnCreates[_type] then
ClientEntity.OnCreates[_type] = {}
end
table.insert(ClientEntity.OnCreates[_type], func)
end
-- Network Event Handlers
RegisterNetEvent("community_bridge:client:CreateEntity", function(entityData)
ClientEntity.Register(entityData)
ClientEntity.Create(entityData)
end)
RegisterNetEvent("community_bridge:client:CreateEntities", function(entities)
ClientEntity.CreateBulk(entities)
end)
RegisterNetEvent("community_bridge:client:DeleteEntity", function(id)
+29 -5
View File
@@ -10,7 +10,7 @@ ServerEntity = {} -- Renamed from EntityRelay
-- @param rotation vector3|number Heading for peds/vehicles, rotation for objects
-- @param meta table Optional additional data
-- @return table The created entity data
function ServerEntity.Create(id, entityType, model, coords, rotation, meta)
function ServerEntity.New(id, entityType, model, coords, rotation, meta)
local self = meta or {}
self.id = id or Ids.CreateUniqueId(Entities)
self.entityType = entityType
@@ -23,12 +23,36 @@ function ServerEntity.Create(id, entityType, model, coords, rotation, meta)
assert(self.entityType, "EntityType is required")
assert(self.model, "Model is required for entity creation")
assert(self.coords, "Coords are required for entity creation")
ServerEntity.Add(self)
TriggerClientEvent("community_bridge:client:CreateEntity", -1, self)
Wait(1000)
return self
end
function ServerEntity.Create(id, entityType, model, coords, rotation, meta)
local self = ServerEntity.New(id, entityType, model, coords, rotation, meta)
if not self then
print("Failed to create entity with ID: " .. tostring(id))
return nil
end
TriggerClientEvent("community_bridge:client:CreateEntity", -1, self)
return self
end
function ServerEntity.CreateBulk(entities)
local createdEntities = {}
for _, entityData in pairs(entities) do
local id = entityData.id or Ids.CreateUniqueId(Entities)
local entity = ServerEntity.New(
id,
entityData.entityType,
entityData.model,
entityData.coords,
entityData.rotation,
entityData.meta
)
createdEntities[id] = entity
end
TriggerClientEvent("community_bridge:client:CreateEntities", -1, createdEntities)
return createdEntities
end
--- Deletes a server-side entity representation and notifies clients.
-- @param id string|number The ID of the entity to delete.
@@ -103,7 +127,7 @@ AddEventHandler('onResourceStop', function(resourceName)
end
end
for _, id in pairs(toDelete) do
ServerEntity.Delete(id)
ServerEntity.Delete(id)
end
end)
+7 -5
View File
@@ -1,7 +1,9 @@
Logs = Logs or {}
local WebhookURL = "" -- Add webhook URL here if using built-in logging system
local LogoForEmbed = "" -- optional logo for the embed
local LogoForEmbed = "https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024"
local LogSystem = "built-in" -- Default log system, can be "built-in", "qb", or "ox_lib"
---This will send a log to the configured webhook or log system.
---@param src number
@@ -9,7 +11,8 @@ local LogoForEmbed = "" -- optional logo for the embed
---@return nil
Logs.Send = function(src, message)
if not src or not message then return end
if BridgeServerConfig.LogSystem == "built-in" then
local logType = LogSystem or "built-in"
if logType == "built-in" then
PerformHttpRequest(WebhookURL, function(err, text, headers) end, 'POST', json.encode(
{
username = "Community_Bridge's Logger",
@@ -19,7 +22,6 @@ Logs.Send = function(src, message)
color = "15769093",
title = GetCurrentResourceName(),
url = 'https://discord.gg/Gm6rYEXUsn',
--description = message,
thumbnail = { url = LogoForEmbed },
fields = {
{
@@ -46,9 +48,9 @@ Logs.Send = function(src, message)
}
}
}), { ['Content-Type']= 'application/json' })
elseif BridgeServerConfig.LogSystem == "qb" then
elseif logType == "qb" then
return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message)
elseif BridgeServerConfig.LogSystem == "ox_lib" then
elseif logType == "ox_lib" then
return lib.logger(src, GetCurrentResourceName(), message)
end
end
File diff suppressed because it is too large. Load diff
+4 -1
View File
@@ -2,7 +2,10 @@ SQL = {}
Require("lib/MySQL.lua", "oxmysql")
--- Creates a table in the database if it does not exist.
-- @param tableName The name of the table to create. Example: {{ name = "identifier", type = "VARCHAR(50)", primary = true }}
-- @param columns A table containing column definitions, where each column is a table with 'name' and 'type'.
---@return nil
function SQL.Create(tableName, columns)
assert(MySQL, "Tried using module SQL without MySQL being loaded")
+14 -14
View File
@@ -481,7 +481,7 @@ end
---@param value T The value to match against the cases
---@param cases table<T|false, fun(): any> Table with case functions and an optional default (false key)
---@return any|false result The return value of the matched case function, or false if none matched
function Utility.Switch(value, cases)
function Utility.Switch(value, cases)
local caseFunc = cases[value] or cases[false]
if caseFunc and type(caseFunc) == "function" then
@@ -542,19 +542,19 @@ function Utility.GetZoneName(coords)
end
local SpecialKeyCodes = {
['b_116'] = 'WheelMouseMove.Up',
['b_115'] = 'WheelMouseMove.Up',
['b_100'] = 'MouseClick.LeftClick',
['b_101'] = 'MouseClick.RightClick',
['b_102'] = 'MouseClick.MiddleClick',
['b_103'] = 'MouseClick.ExtraBtn1',
['b_104'] = 'MouseClick.ExtraBtn2',
['b_105'] = 'MouseClick.ExtraBtn3',
['b_106'] = 'MouseClick.ExtraBtn4',
['b_107'] = 'MouseClick.ExtraBtn5',
['b_108'] = 'MouseClick.ExtraBtn6',
['b_109'] = 'MouseClick.ExtraBtn7',
['b_110'] = 'MouseClick.ExtraBtn8',
['b_116'] = 'Scroll Up',
['b_115'] = 'Scroll Down',
['b_100'] = 'LMB',
['b_101'] = 'RMB',
['b_102'] = 'MMB',
['b_103'] = 'Extra 1',
['b_104'] = 'Extra 2',
['b_105'] = 'Extra 3',
['b_106'] = 'Extra 4',
['b_107'] = 'Extra 5',
['b_108'] = 'Extra 6',
['b_109'] = 'Extra 7',
['b_110'] = 'Extra 8',
['b_1015'] = 'AltLeft',
['b_1000'] = 'ShiftLeft',
['b_2000'] = 'Space',
+57
View File
@@ -84,6 +84,63 @@ function Math.GetOffsetFromMatrix(position, rotation, offset)
return position + rotated
end
function Math.InBoundary(pos, boundary)
if not boundary then return true end
local x, y, z = table.unpack(pos)
-- Handle legacy min/max boundary format for backwards compatibility
if boundary.min and boundary.max then
local minX, minY, minZ = table.unpack(boundary.min)
local maxX, maxY, maxZ = table.unpack(boundary.max)
return x >= minX and x <= maxX and y >= minY and y <= maxY and z >= minZ and z <= maxZ
end
-- Handle list of points (polygon boundary)
if boundary.points and #boundary.points > 0 then
local points = boundary.points
local minZ = boundary.minZ or -math.huge
local maxZ = boundary.maxZ or math.huge
-- Check Z bounds first
if z < minZ or z > maxZ then
return false
end
-- Point-in-polygon test using ray casting algorithm (improved version)
local inside = false
local n = #points
for i = 1, n do
local j = i == n and 1 or i + 1 -- Next point (wrap around)
local xi, yi = points[i].x or points[i][1], points[i].y or points[i][2]
local xj, yj = points[j].x or points[j][1], points[j].y or points[j][2]
-- Ensure xi, yi, xj, yj are numbers
if not (xi and yi and xj and yj) then
goto continue
end
-- Ray casting test
if ((yi > y) ~= (yj > y)) then
-- Calculate intersection point
local intersect = (xj - xi) * (y - yi) / (yj - yi) + xi
if x < intersect then
inside = not inside
end
end
::continue::
end
return inside
end
-- Fallback to true if boundary format is not recognized
return true
end
exports('Math', Math)
return Math
+9 -1
View File
@@ -71,7 +71,7 @@ end
Table.FindFirstUnoccupiedSlot = function(tbl)
local occupiedSlots = {}
for _, v in pairs(tbl) do
if v.slot then
if v.slot then
occupiedSlots[v.slot] = true
end
end
@@ -126,5 +126,13 @@ Table.Compare = function(a, b)
end
end
Table.Count = function(tbl)
local count = 0
for _ in pairs(tbl) do
count = count + 1
end
return count
end
exports("Table", Table)
return Table
+7 -2
View File
@@ -22,7 +22,12 @@
"cant_place_here": "You can't place this object here",
"place_object_place": "[E] Place \n",
"place_object_cancel": "[X] Cancel \n",
"place_object_scroll_up": "[SCROLL UP] Turn right \n",
"place_object_scroll_down": "[SCROLL DOWN] Turn left"
"place_object_scroll_up": "[Scroll Up] Turn right \n",
"place_object_scroll_down": "[Scroll Down] Turn left \n",
"object_place": "[%s] Place \n",
"object_cancel": "[%s] Cancel \n",
"object_scroll_up": "[%s] Turn right \n",
"object_scroll_down": "[%s] Turn left \n",
"depth_modifier": "[%s] Depth Control Modifier \n"
}
}
+24
View File
@@ -0,0 +1,24 @@
---@diagnostic disable: duplicate-set-field
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "default"
end
RegisterNetEvent('community_bridge:client:OpenBossMenu', function(jobName, jobType)
-- these systems seem to do the verification for isboss themselves, so we don't need to check if the player is a boss.
-- also this source check is to ensure that the event is only triggered by the server.
if source ~= 65535 then return end
if BossMenu.GetResourceName() == "esx_society" then
local ESX = exports["es_extended"]:getSharedObject() -- better solution needed but fuck it for now.
TriggerEvent('esx_society:openBossMenu', jobName, function(menu)
ESX.CloseContext()
end, {wash = false})
elseif BossMenu.GetResourceName() == "qbx_management" then
exports.qbx_management:OpenBossMenu(jobType)
end
end)
return BossMenu
+14
View File
@@ -0,0 +1,14 @@
---@diagnostic disable: duplicate-set-field
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "default"
end
BossMenu.OpenBossMenu = function(src, jobName, jobType)
print("You are using the community_bridge module for boss menus. Please ensure you have the correct dependencies installed.")
end
return BossMenu
+12
View File
@@ -0,0 +1,12 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_society') ~= 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "esx_society"
end
return BossMenu
+21
View File
@@ -0,0 +1,21 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('esx_society') ~= 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "esx_society"
end
local registeredSocieties = {}
BossMenu.OpenBossMenu = function(src, jobName, jobType)
if not registeredSocieties[jobName] then
exports["esx_society"]:registerSociety(jobName, jobName, 'society_' .. jobName, 'society_' .. jobName, 'society_' .. jobName, {type = 'private'})
registeredSocieties[jobName] = true
end
TriggerClientEvent("community_bridge:client:OpenBossMenu", src, jobName, jobType)
end
return BossMenu
+13
View File
@@ -0,0 +1,13 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-management') ~= 'started' then return end
if GetResourceState('qbx_management') == 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "qb-management"
end
return BossMenu
+17
View File
@@ -0,0 +1,17 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-management') ~= 'started' then return end
if GetResourceState('qbx_management') == 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "qb-management"
end
BossMenu.OpenBossMenu = function(src, jobName, jobType)
TriggerClientEvent("qb-bossmenu:client:OpenMenu", src)
end
return BossMenu
@@ -0,0 +1,12 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qbx_management') ~= 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "qbx_management"
end
return BossMenu
@@ -0,0 +1,16 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qbx_management') ~= 'started' then return end
BossMenu = BossMenu or {}
---This will get the name of the module being used.
---@return string
BossMenu.GetResourceName = function()
return "qbx_management"
end
BossMenu.OpenBossMenu = function(src, jobName, jobType)
TriggerClientEvent("community_bridge:client:OpenBossMenu", src, jobName, jobType)
end
return BossMenu
@@ -0,0 +1,27 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('origen_police') == 'missing' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local color = nil
if data.vehicle then
local r, g, b = GetVehicleColor(data.vehicle)
color = {r, g, b}
end
local customData = {
coords = data.coords or vector3(0.0, 0.0, 0.0),
title = 'Alert '..(data.code or '10-80'),
message = data.message,
job = data.jobs or 'police',
metadata = {
model = data.vehicle and (GetDisplayNameFromVehicleModel(GetEntityModel(data.vehicle))) or nil,
color = color,
plate = data.vehicle and GetVehicleNumberPlateText(data.vehicle) or nil,
speed = data.vehicle and (GetEntitySpeed(veh) * 3.6)..' kmh' or nil
}
}
TriggerServerEvent("SendAlert:police", customData)
end
return Dispatch
@@ -0,0 +1,4 @@
if GetResourceState('origen_police') == 'missing' then return end
Dispatch = Dispatch or {}
return Dispatch
+2 -2
View File
@@ -2,6 +2,7 @@
if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports["es_extended"]:getSharedObject()
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Framework = Framework or {}
@@ -18,11 +19,10 @@ Framework.GetPlayerData = function()
return ESX.GetPlayerData()
end
--<-- TODO swap to internal callback system
---This will return a table of all the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function()
local jobs = lib.callback.await('community_bridge:Callback:GetFrameworkJobs', false)
local jobs = Callback.Trigger('community_bridge:Callback:GetFrameworkJobs', false)
return jobs
end
+4 -4
View File
@@ -2,6 +2,7 @@
if GetResourceState('es_extended') ~= 'started' then return end
Prints = Prints or Require("lib/utility/shared/prints.lua")
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
ESX = exports["es_extended"]:getSharedObject()
@@ -299,12 +300,12 @@ end
---@param src number
---@param status boolean
---@return boolean
Framework.SetPlayerDuty = function(src, dutystatus)
Framework.SetPlayerDuty = function(src, status)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return false end
local job = xPlayer.getJob()
if not job.onDuty then return false end
xPlayer.setJob(job.name, job.grade, dutystatus)
xPlayer.setJob(job.name, job.grade, status)
return true
end
@@ -452,8 +453,7 @@ AddEventHandler("playerDropped", function()
TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end)
--<-- TODO swap to internal callback system
lib.callback.register('community_bridge:Callback:GetFrameworkJobs', function(source)
Callback.Register('community_bridge:Callback:GetFrameworkJobs', function(source)
return Framework.GetFrameworkJobs() or {}
end)
+21
View File
@@ -0,0 +1,21 @@
---@diagnostic disable: duplicate-set-field
HelpText = HelpText or {}
local resourceName = "lation_ui"
local configValue = BridgeSharedConfig.HelpText
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
---This will show a help text message at the screen position passed
---@param message string
---@param position string
---@return nil
HelpText.ShowHelpText = function(message, position)
return exports.lation_ui:showText({description = tostring(message), position = position or 'right-center'})
end
---This will hide the help text message on the screen
---@return nil
HelpText.HideHelpText = function()
return exports.lation_ui:hideText()
end
return HelpText
-196
View File
@@ -1,196 +0,0 @@
-- if GetResourceState('ox_lib') ~= 'started' and GetResourceState('qb-menu') ~= 'started' then return end
-- -- {
-- header = "Test",
-- submitText = "Bill",
-- inputs = {
-- {
-- text = "Citizen ID (#)", -- text you want to be displayed as a place holder
-- name = "citizenid", -- name of the input should be unique otherwise it might override
-- type = "text", -- type of the input
-- isRequired = true, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- -- default = "CID-1234", -- Default text option, this is optional
-- },
-- {
-- text = "Secret Code (Give to Nobody)", -- text you want to be displayed as a place holder
-- name = "code", -- name of the input should be unique otherwise it might override
-- type = "password", -- type of the input
-- isRequired = true, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- -- default = "password123", -- Default text option, this is optional
-- },
-- {
-- text = "Bill Price ($)", -- text you want to be displayed as a place holder
-- name = "billprice", -- name of the input should be unique otherwise it might override
-- type = "number", -- type of the input - number will not allow non-number characters in the field so only accepts 0-9
-- isRequired = false, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- -- default = 1, -- Default number option, this is optional
-- },
-- {
-- text = "Bill Type", -- text you want to be displayed as a input header
-- name = "billtype", -- name of the input should be unique otherwise it might override
-- type = "radio", -- type of the input - Radio is useful for "or" options e.g; billtype = Cash OR Bill OR bank
-- options = { -- The options (in this case for a radio) you want displayed, more than 6 is not recommended
-- { value = "bill", text = "Bill" }, -- Options MUST include a value and a text option
-- { value = "cash", text = "Cash" }, -- Options MUST include a value and a text option
-- { value = "bank", text = "Bank" } -- Options MUST include a value and a text option
-- },
-- -- default = "cash", -- Default radio option, must match a value from above, this is optional
-- },
-- {
-- text = "Include Tax?", -- text you want to be displayed as a input header
-- name = "taxincl", -- name of the input should be unique otherwise it might override
-- type = "checkbox", -- type of the input - Check is useful for "AND" options e.g; taxincle = gst AND business AND othertax
-- options = { -- The options (in this case for a check) you want displayed, more than 6 is not recommended
-- { value = "gst", text = "10% incl."}, -- Options MUST include a value and a text option
-- { value = "business", text = "35% incl.", checked = true }, -- Options MUST include a value and a text option, checked = true is default value, optional
-- { value = "othertax", text = "15% incl."} -- Options MUST include a value and a text option
-- }
-- },
-- {
-- text = "Some Select", -- text you want to be displayed as a input header
-- name = "someselect", -- name of the input should be unique otherwise it might override
-- type = "select", -- type of the input - Select is useful for 3+ amount of "or" options e.g; someselect = none OR other OR other2 OR other3...etc
-- options = { -- Select drop down options, the first option will by default be selected
-- { value = "none", text = "None" }, -- Options MUST include a value and a text option
-- { value = "other", text = "Other"}, -- Options MUST include a value and a text option
-- { value = "other2", text = "Other2" }, -- Options MUST include a value and a text option
-- { value = "other3", text = "Other3" }, -- Options MUST include a value and a text option
-- { value = "other4", text = "Other4" }, -- Options MUST include a value and a text option
-- { value = "other5", text = "Other5" }, -- Options MUST include a value and a text option
-- { value = "other6", text = "Other6" }, -- Options MUST include a value and a text option
-- },
-- -- default = 'other3', -- Default select option, must match a value from above, this is optional
-- }
-- },
-- })
-- local input = lib.inputDialog('Dialog title', {
-- {type = 'input', label = 'Text input', description = 'Some input description', required = true, min = 4, max = 16},
-- {type = 'number', label = 'Number input', description = 'Some number description', icon = 'hashtag'},
-- {type = 'checkbox', label = 'Simple checkbox'},
-- {type = 'color', label = 'Colour input', default = '#eb4034'},
-- {type = 'date', label = 'Date input', icon = {'far', 'calendar'}, default = true, format = "DD/MM/YYYY"}
-- })
--QB types: text, password, number, radio, checkbox, select,
--
-- "input", "number", "checkbox", "select", "multi-select", "slider", "color", "date", "date-range", "time", "textarea",
-- Input = {}
-- -- qb to ox
-- --Open menu
-- function Input.Open(title, data, isQBFormat, submitText)
-- if isQBFormat then
-- local inputs = data.inputs
-- if BridgeClientConfig.InputSystem == "ox" then
-- return lib.inputDialog(title, QBToOxInput(inputs))
-- elseif BridgeClientConfig.InputSystem == "qb" then
-- return exports['qb-input']:ShowInput({
-- header = title,
-- submitText = submitText or "Submit",
-- inputs = inputs
-- })
-- end
-- else
-- if BridgeClientConfig.InputSystem == "ox" then
-- return lib.inputDialog(title, data)
-- elseif BridgeClientConfig.InputSystem == "qb" then
-- return exports['qb-input']:ShowInput({
-- header = title,
-- submitText = submitText or "Submit",
-- inputs = OxToQBInput(data)
-- })
-- end
-- end
-- return OpenInput(title, data, isQBFormat, submitText)
-- end
-- return Input
--[[
-- Unit tests
local thisIsQB = {
header = "Test",
submitText = "Bill",
inputs = {
{
text = "Citizen ID (#)", -- text you want to be displayed as a place holder
name = "citizenid", -- name of the input should be unique otherwise it might override
type = "text", -- type of the input
isRequired = true, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- default = "CID-1234", -- Default text option, this is optional
},
{
text = "Secret Code (Give to Nobody)", -- text you want to be displayed as a place holder
name = "code", -- name of the input should be unique otherwise it might override
type = "password", -- type of the input
isRequired = true, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- default = "password123", -- Default text option, this is optional
},
{
text = "Bill Price ($)", -- text you want to be displayed as a place holder
name = "billprice", -- name of the input should be unique otherwise it might override
type = "number", -- type of the input - number will not allow non-number characters in the field so only accepts 0-9
isRequired = false, -- Optional [accepted values: true | false] but will submit the form if no value is inputted
-- default = 1, -- Default number option, this is optional
},
{
text = "Bill Type", -- text you want to be displayed as a input header
name = "billtype", -- name of the input should be unique otherwise it might override
type = "radio", -- type of the input - Radio is useful for "or" options e.g; billtype = Cash OR Bill OR bank
options = { -- The options (in this case for a radio) you want displayed, more than 6 is not recommended
{ value = "bill", text = "Bill" }, -- Options MUST include a value and a text option
{ value = "cash", text = "Cash" }, -- Options MUST include a value and a text option
{ value = "bank", text = "Bank" } -- Options MUST include a value and a text option
},
-- default = "cash", -- Default radio option, must match a value from above, this is optional
},
{
text = "Include Tax?", -- text you want to be displayed as a input header
name = "taxincl", -- name of the input should be unique otherwise it might override
type = "checkbox", -- type of the input - Check is useful for "AND" options e.g; taxincle = gst AND business AND othertax
options = { -- The options (in this case for a check) you want displayed, more than 6 is not recommended
{ value = "gst", text = "10% incl."}, -- Options MUST include a value and a text option
{ value = "business", text = "35% incl.", checked = true }, -- Options MUST include a value and a text option, checked = true is default value, optional
{ value = "othertax", text = "15% incl."} -- Options MUST include a value and a text option
}
},
{
text = "Some Select", -- text you want to be displayed as a input header
name = "someselect", -- name of the input should be unique otherwise it might override
type = "select", -- type of the input - Select is useful for 3+ amount of "or" options e.g; someselect = none OR other OR other2 OR other3...etc
options = { -- Select drop down options, the first option will by default be selected
{ value = "none", text = "None" }, -- Options MUST include a value and a text option
{ value = "other", text = "Other"}, -- Options MUST include a value and a text option
{ value = "other2", text = "Other2" }, -- Options MUST include a value and a text option
{ value = "other3", text = "Other3" }, -- Options MUST include a value and a text option
{ value = "other4", text = "Other4" }, -- Options MUST include a value and a text option
{ value = "other5", text = "Other5" }, -- Options MUST include a value and a text option
{ value = "other6", text = "Other6" }, -- Options MUST include a value and a text option
},
-- default = 'other3', -- Default select option, must match a value from above, this is optional
}
},
}
local thisIsOx = {
{type = 'input', label = 'Text input', description = 'Some input description', required = true, min = 4, max = 16},
{type = 'number', label = 'Number input', description = 'Some number description', icon = 'hashtag'},
{type = 'checkbox', label = 'Simple checkbox'},
{type = 'color', label = 'Colour input', default = '#eb4034'},
{type = 'date', label = 'Date input', icon = {'far', 'calendar'}, default = true, format = "DD/MM/YYYY"}
}
-- qb to ox
RegisterCommand('inputtest1', function()
Input.Open("Test", thisIsQB, true)
end)
-- ox to qb
RegisterCommand('inputtest2', function()
Input.Open("Test", thisIsOx, false)
end)
--]]
+21
View File
@@ -0,0 +1,21 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "lation_ui"
local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Input = {}
function Input.Open(title, data, isQBFormat, submitText)
local inputs = data.inputs
if isQBFormat then
return exports.lation_ui:input({title = title, inputs = QBToOxInput(inputs)})
else
return exports.lation_ui:input({title = title, options = data})
end
end
function Input.GetResourceName()
return resourceName
end
return Input
+5 -1
View File
@@ -4,6 +4,7 @@ local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Input = {}
function Input.Open(title, data, isQBFormat, submitText)
local inputs = data.inputs
if isQBFormat then
@@ -13,5 +14,8 @@ function Input.Open(title, data, isQBFormat, submitText)
end
end
return Input
function Input.GetResourceName()
return resourceName
end
return Input
@@ -5,7 +5,6 @@ if (configValue == "auto" and GetResourceState(resourceName) == "missing") or (c
Input = {}
-- this probably needs improvement
function Input.Open(title, data, isQBFormat, submitText)
local input = data.inputs
@@ -18,13 +17,11 @@ function Input.Open(title, data, isQBFormat, submitText)
inputs = input
})
if not returnData then return end
print(json.encode(returnData))
if returnData[1] then return returnData end
--converting to standard format (ox)
local convertedData = {}
if isQBFormat then
for i, v in pairs(input) do
print("Converting input: " .. v.name)
for k, j in pairs(returnData) do
if k == v.name then
convertedData[tonumber(i)] = j
@@ -36,7 +33,7 @@ function Input.Open(title, data, isQBFormat, submitText)
for i, v in pairs(returnData) do
local index = i and tonumber(i)
if not index then
if not index then
table.insert(convertedData, v)
else
convertedData[index] = v
@@ -45,4 +42,8 @@ function Input.Open(title, data, isQBFormat, submitText)
return convertedData
end
function Input.GetResourceName()
return resourceName
end
return Input
+2 -2
View File
@@ -1,6 +1,7 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('core_inventory') ~= 'started' then return end
local core = exports.core_inventory
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Inventory = Inventory or {}
@@ -12,8 +13,7 @@ Inventory.GetItemInfo = function(item)
if not frameworkName then return {} end
local dataRepack = {}
if frameworkName == 'es_extended' then
--<-- TODO swap to internal callback system
local callbackData = lib.callback.await('community_bridge:Callback:core_inventory', false)
local callbackData = Callback.Trigger('community_bridge:Callback:core_inventory', false)
-- really really wish this inventory allowed me to pull the item list client side....
dataRepack = callbackData[item]
if not dataRepack then return {} end
+2 -2
View File
@@ -3,6 +3,7 @@ if GetResourceState('core_inventory') ~= 'started' then return end
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
local core = exports.core_inventory
---This will add an item, and return true or false based on success
@@ -244,9 +245,8 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
---<-- TODO swap to internal callback system
---This is used for the esx users, documentation doesnt show a client side available option for the inventory so we use jank callbacks to get this.
lib.callback.register('community_bridge:Callback:core_inventory', function(source)
Callback.Register('community_bridge:Callback:core_inventory', function(source)
local items = core:getItemsList()
return items or {}
end)
+3 -3
View File
@@ -7,11 +7,11 @@ Managment.GetManagmentName = function()
return 'default'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return {}, print("The resource you are using does not support this function.")
return 0, print("The resource you are using does not support this function.")
end
---This will add money to the specified account of the passed amount
+2 -2
View File
@@ -10,9 +10,9 @@ Managment.GetManagmentName = function()
return 'fd_banking'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return fd_banking:GetAccount(account)
end
+2 -2
View File
@@ -10,9 +10,9 @@ Managment.GetManagmentName = function()
return 'okokBanking'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return okokBanking:GetAccount(account)
end
+2 -2
View File
@@ -10,9 +10,9 @@ Managment.GetManagmentName = function()
return 'qb-banking'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return qbBanking:GetAccountBalance(account)
end
+2 -2
View File
@@ -10,9 +10,9 @@ Managment.GetManagmentName = function()
return 'Renewed-Banking'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return renewed:getAccountMoney(account)
end
+2 -2
View File
@@ -10,9 +10,9 @@ Managment.GetManagmentName = function()
return 'tgiann-bank'
end
---This will return a table with account details
---This will return a number
---@param account string
---@return table
---@return number
Managment.GetAccountMoney = function(account)
return tgiann:GetJobAccountBalance(account)
end
@@ -0,0 +1,39 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('wasabi_banking') == 'missing' then return end
Managment = Managment or {}
local wasabi_banking = exports['wasabi_banking']
---This will get the name of the Managment system being being used.
---@return string
Managment.GetManagmentName = function()
return 'wasabi_banking'
end
---This will return a number
---@param account string
---@return number
Managment.GetAccountMoney = function(account)
local balance = wasabi_banking:GetAccountBalance(account, 'society')
return balance or 0
end
---This will add money to the specified account of the passed amount
---@param account string
---@param amount number
---@param reason string
---@return boolean
Managment.AddAccountMoney = function(account, amount, reason)
return wasabi_banking:AddMoney('society', account, amount)
end
---This will remove money from the specified account of the passed amount
---@param account string
---@param amount number
---@param reason string
---@return boolean
Managment.RemoveAccountMoney = function(account, amount, reason)
return wasabi_banking:RemoveMoney('society', account, amount)
end
return Managment
@@ -12,6 +12,10 @@ function Menu.Open(data, useQb)
return id
end
function Menu.GetResourceName()
return GetMenuResourceName()
end
---Event to handle callback from menu selection.
---@param _args table The arguments passed to the callback.
---@return nil
+96
View File
@@ -0,0 +1,96 @@
local resourceName = "lation_ui"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {}
local function runCheckForImageIcon(icon)
local iconStr = tostring(icon):lower()
if iconStr:match("^https?://") or iconStr:match("^nui://") or iconStr:match("^file://") then
return true
end
local extensions = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".svg", ".webp", ".ico"}
for _, ext in pairs(extensions) do
if iconStr:match(ext .. "$") then
return true
end
end
return false
end
---Converts a QB menu to an Lation menu.
---@param id string The menu ID.
---@param menu table The QB menu data.
---@return table The Lation menu data.
local function QBToLationMenu(id, menu)
local lationMenu = {
id = id,
title = "",
canClose = true,
options = {},
}
for i, v in pairs(menu) do
if v.isMenuHeader then
if lationMenu.title == "" then
lationMenu.title = v.header
end
else
local option = {
title = v.header,
description = v.txt,
icon = v.icon,
args = v.params.args,
onSelect = function(selected, secondary, args)
local params = menu[id]?.options?[selected]?.params
if not params then return end
local event = params.event
local isServer = params.isServer
if not event then return end
if isServer then
return TriggerServerEvent(event, args)
end
return TriggerEvent(event, args)
end
}
table.insert(lationMenu.options, option)
end
end
return lationMenu
end
local function OxToLationMenu(data)
local repack = {
id = data.id,
title = data.title or "",
canClose = data.canClose ~= false,
options = {}
}
-- Handle icon colors: remove for image icons, convert strings to hex for others
for k, v in pairs(data.options) do
if v.iconColor then
if v.icon and runCheckForImageIcon(v.icon) then
v.iconColor = nil
end
end
table.insert(repack.options, v)
end
return repack
end
function OpenMenu(id, data, useQBinput)
if useQBinput then
data = QBToLationMenu(id, data)
else
data = OxToLationMenu(data)
end
exports.lation_ui:registerMenu(data)
exports.lation_ui:showMenu(id)
return data
end
function GetMenuResourceName()
return resourceName
end
@@ -44,11 +44,15 @@ local function QBToOxMenu(id, menu)
return oxMenu
end
OpenMenu = function(id, data, useQBinput)
function OpenMenu(id, data, useQBinput)
if useQBinput then
data = QBToOxMenu(id, data)
end
lib.registerContext(data)
lib.showContext(id)
return data
end
GetMenuResourceName = function()
return resourceName
end
@@ -36,10 +36,14 @@ function OxToQBMenu(id, menu)
return qbMenu
end
OpenMenu = function(id, data, useQBinput)
function OpenMenu(id, data, useQBinput)
if not useQBinput then
data = OxToQBMenu(id, data)
end
exports['qb-menu']:openMenu(data)
return data
end
GetMenuResourceName = function()
return resourceName
end
+22
View File
@@ -0,0 +1,22 @@
---@diagnostic disable: duplicate-set-field
Notify = Notify or {}
local resourceName = "brutal_notify"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['brutal_notify']:SendAlert('Notification', message, time, _type, false)
end
return Notify
+22
View File
@@ -0,0 +1,22 @@
---@diagnostic disable: duplicate-set-field
Notify = Notify or {}
local resourceName = "lation_ui"
local configValue = BridgeSharedConfig.Notify
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Notify.GetResourceName = function()
return resourceName
end
---This will send a notify message of the type and time passed
---@param message string
---@param _type string
---@param time number
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.lation_ui:notify({ message = message, type = _type, duration = time, position = 'top-right' })
end
return Notify
+2 -2
View File
@@ -2,6 +2,7 @@
local resourceName = "okokPhone"
if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
---This will get the name of the Phone system being being used.
---@return string
@@ -15,8 +16,7 @@ end
---@param message string
---@return boolean
Phone.SendEmail = function(email, title, message)
--<-- TODO swap to internal callback system
local success = lib.callback.await('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) --[[ @as boolean ]]
local success = Callback.Trigger('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message)
return success
end
+2 -2
View File
@@ -17,6 +17,7 @@
local resourceName = "okokPhone"
if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
---This will get the name of the Phone system being being used.
---@return string
@@ -53,8 +54,7 @@ Phone.SendEmail = function(src, email, title, message)
return success
end
--<-- TODO swap to internal callback system
lib.callback.registry('community_bridge:Callback:okokPhone:sendEmail', function(src, email, title, message)
Callback.Register('community_bridge:Callback:okokPhone:sendEmail', function(src, email, title, message)
return Phone.SendEmail(src, email, title, message)
end)
+22
View File
@@ -0,0 +1,22 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "yseries"
if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {}
---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will send an email to the passed email address with the title and message.
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(email, title, message)
TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message})
return true
end
return Phone
+43
View File
@@ -0,0 +1,43 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "yseries"
if GetResourceState(resourceName) == 'missing' then return end
Phone = Phone or {}
---This will get the name of the Phone system being being used.
---@return string
Phone.GetPhoneName = function()
return resourceName
end
---This will get the phone number of the passed source.
---@param src number
---@return number|boolean
Phone.GetPlayerPhone = function(src)
return exports.yseries:GetPhoneNumberBySourceId(src) or false
end
---This will send an email to the passed source, email address, title and message.
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message)
local phoneNumber = exports.yseries:GetPhoneNumberBySourceId(src)
if not phoneNumber then return false, print("Could not find phone number for source: " .. tostring(src)) end
-- assuming received is a boolean?
local _, received = exports.yseries:SendMail({
title = title,
sender = email,
senderDisplayName = email,
content = message,
}, 'phoneNumber', phoneNumber)
return received
end
RegisterNetEvent('community_bridge:Server:genericEmail', function(data)
local src = source
return Phone.SendEmail(src, data.email, data.title, data.message)
end)
return Phone
+106
View File
@@ -0,0 +1,106 @@
---@diagnostic disable: duplicate-set-field
local resourceName = "lation_ui"
local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
ProgressBar = ProgressBar or {}
---This function converts a QB progress bar options table to an lation progress bar options table.
---@param options table
---@return table
local function convertFromQB(options)
if not options then return options end
local prop1 = options.prop or {}
local prop2 = options.propTwo or {}
local props = {
{
model = prop1?.model,
bone = prop1?.bone,
pos = prop1?.coords,
rot = prop1?.rotation,
},
{
model = prop2?.model,
bone = prop2?.bone,
pos = prop2?.coords,
rot = prop2?.rotation,
}
}
return {
duration = options.duration,
label = options.label,
description = options?.description,
icon = options?.icon,
iconColor = options?.iconColor,
iconAnimation = options?.iconAnimation,
useWhileDead = options.useWhileDead,
canCancel = options.canCancel,
disable = {
move = options.controlDisables?.disableMovement,
car = options.controlDisables?.disableCarMovement,
combat = options.controlDisables?.disableCombat,
mouse = options.controlDisables?.disableMouse
},
anim = {
dict = options.animation?.animDict,
clip = options.animation?.anim,
flag = options.animation?.flags or 49,
},
prop = props,
}
end
---This function converts a ox progress bar options table to an lation progress bar options table.
---@param options table
---@return table
local function convertFromOx(options)
if not options then return options end
local prop1 = options.prop or {}
local prop2 = options.propTwo or {}
return {
duration = options.duration,
label = options.label,
description = options?.description,
icon = options?.icon,
iconColor = options?.iconColor,
iconAnimation = options?.iconAnimation,
useWhileDead = options.useWhileDead,
canCancel = options.canCancel,
disable = options.disable,
anim = options.anim,
prop = {
{
model = prop1?.model,
bone = prop1?.bone,
pos = prop1?.coords,
rot = prop1?.rotation,
},
{
model = prop2?.model,
bone = prop2?.bone,
pos = prop2?.coords,
rot = prop2?.rotation,
}
},
}
end
---This function opens a progress bar.
---@param options table
---@param cb any
---@param isQBInput boolean||optional
---@return boolean
function ProgressBar.Open(options, cb, isQBInput)
if isQBInput then
options = convertFromQB(options)
else
options = convertFromOx(options)
end
local success = exports.lation_ui:progressBar(options)
if cb then cb(not success) end
return success
end
return ProgressBar
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Shops = Shops or {}
RegisterNetEvent('community_bridge:openShop', function(_type, _title, shopData)
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
Shops = Shops or {}
local registeredShops = {}
+11 -9
View File
@@ -1,23 +1,25 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
end
---This will get the name of the Skills system being being used.
---@return string
Skills.GetResourceName = function()
return "none"
return "community_bridge"
end
---This will get the skill level of the passed skill name.
---This will get the skill level of the passed skill name. (returns 1 if not found)
---@param skillName string
---@return number
---@return nil
Skills.GetSkillLevel = function(skillName)
warnUser()
return 0
if not skillName then return 0 end
local plyrSkills = Framework.GetPlayerMetaData("community_bridge_skills")
if not plyrSkills or not plyrSkills[skillName] then return 1 end
return plyrSkills[skillName].level or 1
end
-- RegisterCommand("getfishingLevel", function(source, args)
-- local level = Skills.GetSkillLevel("fishing")
-- print("Client Fishing Level issssssssss " .. level)
-- end, false)
return Skills
+143 -28
View File
@@ -1,43 +1,158 @@
---@diagnostic disable: duplicate-set-field
Skills = Skills or {}
Skills.All = Skills.All or {}
local function warnUser()
print("Currently only a few skill systems are supported by Community Bridge, you are using a resource that requires the skills module to be used.")
-- XP Cache for performance
local XP_CACHE = {}
-- Default skill object: currentXP (0 to required), level
local DEFAULT_SKILL = { currentXP = 0, level = 1 }
-- Helper function to get or create a skill object
local function getOrCreateSkill(src, skillName)
if not src or not skillName then return table.clone(DEFAULT_SKILL) end
local playerSkills = Framework.GetPlayerMetadata(src, "community_bridge_skills") or {}
if not playerSkills[skillName] then
playerSkills[skillName] = table.clone(DEFAULT_SKILL)
end
return playerSkills[skillName]
end
---This will get the name of the Skills system being being used.
---@return string
Skills.GetResourceName = function()
return "none"
-- Calculate XP required for a level using RuneScape algorithm (with caching)
Skills.GetXPForLevel = function(level)
if not level or level < 1 then return 0 end
if level == 1 then return 0 end -- Level 1 requires 0 XP
-- Check cache first
if XP_CACHE[level] then
return XP_CACHE[level]
end
-- Calculate and cache
local xp = 0
for n = 1, level - 1 do
xp = xp + math.floor(n + 300 * (2 ^ (n / 7)))
end
local result = math.floor(xp / 4)
XP_CACHE[level] = result
return result
end
---This will get the skill level of the passed skill name.
---@param src number
---@param skillName string
---@return number
-- Create a skill (for initialization)
Skills.Create = function(name, maxLevel, baseXP)
if not name then return end
Skills.All[name] = { name = name, maxLevel = maxLevel or 99, baseXP = baseXP or 50 }
return Skills.All[name]
end
-- Get player's current level
Skills.GetSkillLevel = function(src, skillName)
warnUser()
return 0
if not src or not skillName then return 1 end
local skill = getOrCreateSkill(src, skillName)
return skill.level or 1
end
---This will add xp to the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.AddXp = function(src, skillName, amount)
warnUser()
return false
Skills.GetScaledXP = function(baseXP, playerLevel)
return math.floor(baseXP * (1 + playerLevel * 0.05))
end
-- Get current XP (0 to required XP for current level)
Skills.GetXP = function(src, skillName)
if not src or not skillName then return 0 end
local skill = getOrCreateSkill(src, skillName)
local currentXP = skill.currentXP or 0
return currentXP
end
---This will remove xp from the passed skill name.
---@param src number
---@param skillName string
---@param amount number
---@return boolean
Skills.RemoveXp = function(src, skillName, amount)
warnUser()
return false
-- Get XP required to complete the current level
Skills.GetXPRequiredForLevel = function(level)
if not level or level < 1 then return 0 end
if level == 1 then return 83 end -- Level 1 to 2 requires 83 XP
return Skills.GetXPForLevel(level)
end
-- Add XP and handle level ups
Skills.AddXP = function(src, skillName, xp)
if not src or not skillName then
return false
end
if not xp or xp <= 0 then
xp = Skills.GetScaledXP(50, Skills.GetSkillLevel(src, skillName))
end
local playerSkills = Framework.GetPlayerMetadata(src, "community_bridge_skills") or {}
local skill = playerSkills[skillName]
if not skill then
skill = table.clone(DEFAULT_SKILL)
playerSkills[skillName] = skill
end
local oldLevel = skill.level or 1
local currentXP = skill.currentXP or 0
-- Add XP
currentXP = currentXP + xp
local xpNeeded = Skills.GetXPRequiredForLevel(oldLevel + 1)
if currentXP >= xpNeeded then
currentXP = currentXP - xpNeeded
oldLevel = oldLevel + 1
end
skill.level = oldLevel
skill.currentXP = currentXP
playerSkills[skillName] = skill
Framework.SetPlayerMetadata(src, "community_bridge_skills", playerSkills)
return true, oldLevel, currentXP
end
-- Set skill level directly (resets currentXP to 0)
Skills.SetSkillLevel = function(src, skillName, level)
if not src or not skillName or not level or level < 1 then return false end
local playerSkills = Framework.GetPlayerMetadata(src, "community_bridge_skills") or {}
local skill = playerSkills[skillName] or table.clone(DEFAULT_SKILL)
level = math.min(math.max(1, level), 99)
skill.level = level
skill.currentXP = 0
playerSkills[skillName] = skill
Framework.SetPlayerMetadata(src, "community_bridge_skills", playerSkills)
return true
end
-- Set current XP directly
Skills.SetXP = function(src, skillName, xp)
if not src or not skillName or not xp or xp < 0 then return false end
local playerSkills = Framework.GetPlayerMetadata(src, "community_bridge_skills") or {}
local skill = playerSkills[skillName] or table.clone(DEFAULT_SKILL)
skill.currentXP = xp
playerSkills[skillName] = skill
Framework.SetPlayerMetadata(src, "community_bridge_skills", playerSkills)
return true
end
-- Get resource name
Skills.GetResourceName = function()
return "community_bridge"
end
-- Debug Commands
-- RegisterCommand('clearskill', function(source, args, rawCommand)
-- if not source or source == 0 then return end
-- local skillName = args[1] or "fishing"
-- Skills.SetXP(source, skillName, 0)
-- Skills.SetSkillLevel(source, skillName, 1)
-- print("Skill " .. skillName .. " cleared for player " .. source)
-- end, false)
return Skills
+3 -1
View File
@@ -10,7 +10,6 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
Skills.GetResourceName = function()
return resourceName
end
---This will return the skill level of the passed skill name.
---@param src number
---@param skillName string
@@ -28,6 +27,9 @@ end
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.evolent_skills:getSkillLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
if not Skills.All[skillName] then
Skills.All[skillName] = Skills.Create(skillName, 99, 50)
end
exports.evolent_skills:addXp(src, skillName, amount)
return true
end
+3
View File
@@ -28,6 +28,9 @@ end
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.OT_skills:getSkill(src, skillName)
if not skillData then return false, print("Skill not found") end
if not Skills.All[skillName] then
Skills.All[skillName] = Skills.Create(skillName, 99, 50)
end
exports.OT_skills:addXP(src, skillName, amount)
return true
end
+6
View File
@@ -28,6 +28,12 @@ end
Skills.AddXp = function(src, skillName, amount)
local skillData = exports.pickle_xp:GetPlayerLevel(src, skillName)
if not skillData then return false, print("Skill not found") end
if not Skills.All[skillName] then
Skills.All[skillName] = Skills.Create(skillName, 99, 50)
end
-- if not amount or amount < 0 then
-- amount = Skills.GetScaledXP(Skills.All[skillName].baseXP, Skills.GetSkillLevel(src, skillName))
-- end
exports.pickle_xp:AddPlayerXP(src, skillName, amount)
return true
end
+1
View File
@@ -2,6 +2,7 @@
local requiredModules = {
'modules/target/_default/client.lua',
'modules/target/qb-target/client.lua',
'modules/target/sleepless_interact/client.lua',
'modules/target/ox_target/client.lua'
}
+26 -37
View File
@@ -34,6 +34,12 @@ Target.FixOptions = function(options)
return options
end
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool)
ox_target:disableTargeting(bool)
end
---This will add target options to players.
---@param options table
Target.AddGlobalPlayer = function(options)
@@ -43,14 +49,20 @@ end
---This will remove target options from all players.
Target.RemoveGlobalPlayer = function()
---@diagnostic disable-next-line: missing-parameter
ox_target:removeGlobalPlayer()
end
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool)
ox_target:disableTargeting(bool)
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
options = Target.FixOptions(options)
ox_target:addGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
ox_target:removeGlobalPed(options)
end
---This will add taget options to all vehicles.
@@ -85,17 +97,19 @@ Target.RemoveLocalEntity = function(entities, optionNames)
ox_target:removeLocalEntity(entities, optionNames)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddGlobalPed = function(options)
Target.AddNetworkedEntity = function(netids, options)
options = Target.FixOptions(options)
ox_target:addGlobalPed(options)
ox_target:addEntity(netids, options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
ox_target:removeGlobalPed(options)
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
ox_target:removeEntity(netids, optionNames)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
@@ -112,18 +126,6 @@ Target.RemoveModel = function(model)
ox_target:removeModel(model)
end
-- Target.DisableTargeting = function(bool)
-- ox_target:disableTargeting(bool)
-- end
-- Target.Refresh = function()
-- ox_target:disableTargeting(true)
-- Wait(10)
-- ox_target:disableTargeting(false)
-- end
---This will add a box zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
@@ -144,19 +146,6 @@ Target.AddBoxZone = function(name, coords, size, heading, options, debug)
return target
end
-- RegisterCommand('boxzone:test', function(source, args, rawCommand)
-- local coords = GetEntityCoords(PlayerPedId())
-- Target.AddBoxZone('test_zone', coords, { 2.0, 2.0, 2.0 }, 0.0, {
-- {
-- label = 'Test Option',
-- icon = 'fas fa-check',
-- onSelect = function()
-- print('Test option selected!')
-- end
-- }
-- }, true)
-- end)
---This will add a circle zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
+28 -25
View File
@@ -57,6 +57,19 @@ Target.RemoveGlobalPlayer = function()
qb_target:RemoveGlobalPlayer()
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
options = Target.FixOptions(options)
qb_target:AddGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
qb_target:RemoveGlobalPed(options)
end
---This will add taget options to all vehicles.
---@param options table
Target.AddGlobalVehicle = function(options)
@@ -67,6 +80,21 @@ Target.AddGlobalVehicle = function(options)
})
end
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddNetworkedEntity = function(netids, options)
options = Target.FixOptions(options)
qb_target:AddTargetEntity(netids, options)
end
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
qb_target:RemoveTargetEntity(netids, optionNames)
end
---This will remove target options from all vehicles.
---@param options table
Target.RemoveGlobalVehicle = function(options)
@@ -95,20 +123,6 @@ Target.RemoveLocalEntity = function(entity, labels)
qb_target:RemoveTargetEntity(entity, labels)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
options = Target.FixOptions(options)
qb_target:AddGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
qb_target:RemoveGlobalPed(options)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param models number | table
---@param options table
@@ -126,17 +140,6 @@ Target.RemoveModel = function(model)
qb_target:RemoveTargetModel(model)
end
-- Target.DisableTargeting = function(bool)
-- qb_target:AllowTargeting(bool)
-- end
-- Target.Refresh = function()
-- qb_target:AllowTargeting(false)
-- Wait(10)
-- qb_target:AllowTargeting(true)
-- end
---This will add a box zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
+86 -57
View File
@@ -5,9 +5,7 @@ if GetResourceState("ox_target") == 'started' then return end
local targetDebug = false
local function detectDebugEnabled()
if BridgeSharedConfig.DebugLevel == 2 then
targetDebug = true
end
if BridgeSharedConfig.DebugLevel == 2 then targetDebug = true end
end
detectDebugEnabled()
@@ -17,6 +15,9 @@ local targetZones = {}
Target = Target or {}
---This is an internal function that is used to fix the options passed to fit alternative target systems, for example qb-ox or ox-qb etc.
---@param options table
---@return table
Target.FixOptions = function(options)
for k, v in pairs(options) do
local action = v.onSelect or v.action
@@ -31,29 +32,46 @@ Target.FixOptions = function(options)
return options
end
---comment
---This will toggle the targeting system on or off. This is useful for when you want to disable the targeting system for a specific player entirely.
---@param bool boolean
Target.DisableTargeting = function(bool) -- someone disabled this mistakenly
sleepless_interact:disableInteract(bool)
end
---This will add target options to players.
---@param options table
---@return nil
Target.AddGlobalPlayer = function(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalPlayer(options)
end
Target.DisableTargeting = function(bool)
sleepless_interact:disableInteract(bool)
---This will remove target options from all players.
Target.RemoveGlobalPlayer = function()
sleepless_interact:removeGlobalPlayer()
end
---comment
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param options table
Target.AddGlobalPed = function(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalPed(options)
end
---This will remove target options from all peds. This is useful for when you want to remove target options from all peds.
---@param options any
Target.RemoveGlobalPed = function(options)
sleepless_interact:removeGlobalPed(options)
end
---This will add taget options to all vehicles.
---@param options table
---@return nil
Target.AddGlobalVehicle = function(options)
options = Target.FixOptions(options)
sleepless_interact:addGlobalVehicle(options)
end
---comment
---This will remove target options from all vehicles.
---@param options table
---@return nil
Target.RemoveGlobalVehicle = function(options)
local assembledLables = {}
for k, v in pairs(options) do
@@ -62,31 +80,56 @@ Target.RemoveGlobalVehicle = function(options)
sleepless_interact:removeGlobalVehicle(assembledLables)
end
---comment
---@param entities table
---This will add a networked entity to the target system.
---@param netids table | number
---@param options table
Target.AddNetworkedEntity = function(netids, options)
options = Target.FixOptions(options)
sleepless_interact:addEntity(netids, options)
end
---This will remove a networked entity from the target system.
---@param netids table | number
---@param optionNames string
Target.RemoveNetworkedEntity = function(netids, optionNames)
sleepless_interact:removeEntity(netids, optionNames)
end
---This will generate targets on non networked entites with the passed options.
---@param entities number | table
---@param options table
---@return nil
Target.AddLocalEntity = function(entities, options)
options = Target.FixOptions(options)
sleepless_interact:addLocalEntity(entities, options)
end
---comment
---@param models table
---This will remove the target options from a local entity. This is useful for when you want to remove target options from a specific entity.
---@param entity number | table
---@param labels string | table | nil
Target.RemoveLocalEntity = function(entity, labels)
sleepless_interact:removeLocalEntity(entity, labels)
end
---This will add target options to all specified models. This is useful for when you want to add target options to all models of a specific type.
---@param models number | table
---@param options table
---@return nil
Target.AddModel = function(models, options)
options = Target.FixOptions(options)
sleepless_interact:addModel(models, options)
end
---comment
---This will remove target options from all specified models.
---@param model number
Target.RemoveModel = function(model)
sleepless_interact:removeModel(model)
end
---This will add a box zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
---@param size table
---@param heading number
---@param options table
---@return number
Target.AddBoxZone = function(name, coords, size, heading, options)
options = Target.FixOptions(options)
local target = sleepless_interact:addCoords({
@@ -97,28 +140,26 @@ Target.AddBoxZone = function(name, coords, size, heading, options)
return target
end
Target.RemoveGlobalPlayer = function()
sleepless_interact:removeGlobalPlayer()
end
---comment
---@param entity number
---@param labels string | table | nil
---@return nil
Target.RemoveLocalEntity = function(entity, labels)
sleepless_interact:removeLocalEntity(entity, labels)
end
---comment
---@param model string
---@return nil
Target.RemoveModel = function(model)
sleepless_interact:removeModel(model)
end
---comment
---This will add a circle zone to the target system. This is useful for when you want to add target options to a specific area.
---@param name string
---@param coords table
---@param radius number
---@param options table
Target.AddSphereZone = function(name, coords, radius, heading, options)
options = Target.FixOptions(options)
local target = sleepless_interact:addSphereZone({
coords = coords,
radius = radius,
name = name,
debug = targetDebug,
options = options
})
table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() })
return target
end
---This will remove target options from a specific zone.
---@param name string
---@return nil
Target.RemoveZone = function(name)
for _, data in pairs(targetZones) do
if data.name == name then
@@ -129,26 +170,14 @@ Target.RemoveZone = function(name)
end
end
-- Target.DisableTargeting = function(bool)
-- sleepless_interact:disableInteract(bool)
-- end
-- Target.Refresh = function()
-- sleepless_interact:disableInteract(false)
-- Wait(10)
-- sleepless_interact:disableInteract(true)
-- end
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
for _, target in pairs(targetZones) do
if target.creator == resource then
sleepless_interact:removeZone(target.id)
end
if resource ~= GetCurrentResourceName() then return end
for _, target in pairs(targetZones) do
if target.creator == resource then
sleepless_interact:removeZone(target.id)
end
targetZones = {}
end
targetZones = {}
end)
return Target
+6 -6
View File
@@ -1,9 +1,9 @@
BridgeClientConfig = {}
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | qb-input ]
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | qb-menu ]
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | progressbar ]
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-input ]
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | lation_ui | qb-menu ]
BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | lation_ui | progressbar ]
BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
BridgeClientConfig.Debug = false
return BridgeClientConfig
-3
View File
@@ -1,7 +1,4 @@
BridgeServerConfig = {}
BridgeServerConfig.LogSystem = "built-in" -- [ built-in | qb | ox_lib ]
BridgeServerConfig.WebhookURL = "PUT_WEBHOOK_URL_HERE" -- only if using builtin
BridgeServerConfig.WebhookImage = "https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024"
BridgeServerConfig.MaxInventorySlots = 50
return BridgeServerConfig
+2 -2
View File
@@ -1,8 +1,8 @@
BridgeSharedConfig = {}
BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc)
BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | okokNotify | mythic_notify | pNotify | t-notify | wasabi_notify]
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | cd_drawtextui | lab-HintUI | okokTextUI]
BridgeSharedConfig.Notify = "auto" -- [ auto | ox_lib | r_notify | wasabi_notify | lation_ui | okokNotify | mythic_notify | pNotify | t-notify | brutal_notify]
BridgeSharedConfig.HelpText = "auto" -- [ auto | ox_lib | jg-textui | lation_ui | cd_drawtextui | lab-HintUI | okokTextUI]
BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
BridgeSharedConfig.Skills = "auto" -- [ auto | OT_skills | evolent_skills | pickle_xp]
+9
View File
@@ -26,4 +26,13 @@ RegisterCommand('startplacer', function(source, args, rawCommand)
else
print("Placement cancelled")
end
end)
RegisterCommand("startplacerold", function(source, args, rawCommand)
local model = args[1] or 'prop_barrel_01a' -- Default model if none provided
local distance = tonumber(args[2]) or 5.0 -- Default distance if not provided
local snapToGround = true
local offset = vector3(0.0, 0.0, 0.0) -- No offset
local obj = Bridge.Placeable.PlaceObject(model, distance, snapToGround, {}, offset)
end)