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

Dev
This commit is contained in:
MrNewb authored and GitHub committed 2025-06-13 17:40:28 -04:00
commit 0f4fdc5305
20 files changed
+245 -143

No files matched your search

+16 -7
View File
@@ -12,20 +12,31 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq zip
- name: Create release ZIP
run: |
zip -r community_bridge.zip . -x ".git/*" ".github/*"
- name: Upload ZIP to release
uses: softprops/action-gh-release@v1
with:
files: community_bridge.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Send webhook notification
env:
WEBHOOK_URL: ${{ secrets.RELEASE_WEBHOOK_URL }}
run: |
# Extract repository name and release details
REPO_NAME=$(basename "$GITHUB_REPOSITORY")
RELEASE_VERSION=$(jq -r '.release.tag_name // "Unknown Version"' "$GITHUB_EVENT_PATH")
TITLE="$REPO_NAME $RELEASE_VERSION"
DESCRIPTION=$(jq -r '.release.body // "No description provided."' "$GITHUB_EVENT_PATH")
# Construct JSON payload
PAYLOAD=$(jq -n \
--arg title "$TITLE" \
--arg description "$DESCRIPTION" \
@@ -57,17 +68,15 @@ jobs:
"type": 2,
"style": 5,
"label": "Get The Latest Community Bridge Release",
"url": "https://github.com/The-Order-Of-The-Sacred-Framework/community_bridge/tree/main"
"url": "https://github.com/The-Order-Of-The-Sacred-Framework/community_bridge/releases/latest"
}
]
}
]
}')
# Debugging: Print the payload for verification
echo "$PAYLOAD"
# Send webhook
curl -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
--data-raw "$PAYLOAD" || exit 1
+18 -70
View File
@@ -3,11 +3,10 @@
<div align="center">
![License](https://img.shields.io/badge/license-GPLv3-blue.svg)
![FiveM](https://img.shields.io/badge/FiveM-Compatible-green.svg)
![Version](https://img.shields.io/badge/version-latest-brightgreen.svg)
![Contributors](https://img.shields.io/github/contributors/The-Order-Of-The-Sacred-Framework/community_bridge?style=for-the-badge&logo=github&color=blue)
![](https://img.shields.io/github/downloads/The-Order-Of-The-Sacred-Framework/community_bridge/total?logo=github)
![](https://img.shields.io/github/downloads/The-Order-Of-The-Sacred-Framework/community_bridge/latest/total?logo=github)
![](https://img.shields.io/github/contributors/The-Order-Of-The-Sacred-Framework/community_bridge?logo=github)
![](https://img.shields.io/github/v/release/The-Order-Of-The-Sacred-Framework/community_bridge?logo=github)
*A modular, beginner-friendly collection of tools and systems designed to simplify and unify FiveM development.*
@@ -17,6 +16,20 @@
---
## 📚 Documentation
Read the full documentation here:
👉 [Our Gitbook Here](https://mrnewbs-scrips.gitbook.io/the-order-of-the-sacred-framework)
---
## 💬 Join the Community
Have questions, suggestions, or want to contribute? Join us on Discord:
👉 [Our Discord Here](https://discord.gg/MukwBuJjP7)
---
## 🚀 Overview & Features
**Community Bridge** is a comprehensive compatibility layer that acts as a universal wrapper around all major systems used across FiveM frameworks. Whether you're building with QB-Core, ESX, QBox, or any other framework, this bridge ensures your scripts work seamlessly across all environments.
@@ -171,71 +184,6 @@ A: We release updates regularly to maintain compatibility and add new features b
---
## 🚀 Quick Start
### Installation
1. **Download** the latest release from GitHub
2. **Extract** to your resources folder: `[bridges]/community_bridge`
3. **Add** to your `server.cfg`:
```cfg
ensure community_bridge
```
4. **Restart** your server
---
## 📚 Documentation
Read the full documentation here:
👉 [Our Gitbook Here](https://mrnewbs-scrips.gitbook.io/the-order-of-the-sacred-framework)
---
## 🤝 Contributing
We welcome contributions from the community! Here's how you can help:
### How to Contribute
1. **Fork** this repositorys dev branch
2. **Commit** your changes (`git commit -m 'Add amazing feature'`)
3. **Push** to the branch (`git push origin feature/amazing-feature`)
4. **Open** a Pull Request
### Guidelines
- ✅ Follow existing code style and patterns
- ✅ Test your changes thoroughly
- ✅ Update documentation when needed
- ✅ Be respectful and constructive in discussions
---
## 💬 Join the Community
Have questions, suggestions, or want to contribute? Join us on Discord:
👉 [Our Discord Here](https://discord.gg/MukwBuJjP7)
---
## 📄 License
This project is licensed under the **GPLv3 License** - see the [LICENSE](LICENSE) file for details.
### Attribution
Some modules include contributions from the FiveM community. Full attributions are listed in the `Attributions` file.
---
## ⭐ Support the Project
If Community Bridge has helped your development workflow, consider:
- ⭐ **Starring** this repository
- 🐛 **Reporting** bugs and issues
- 💡 **Suggesting** new features
- 🤝 **Contributing** code or documentation
- 💬 **Sharing** with other developers
---
> "Connecting what matters — frameworks unified, development simplified."
<div align="center">
+1 -1
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.0'
version '0.9.1'
shared_scripts {
'@ox_lib/init.lua',
+81
View File
@@ -541,6 +541,87 @@ function Utility.GetZoneName(coords)
return GetLabelText(zoneHash)
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_1015'] = 'AltLeft',
['b_1000'] = 'ShiftLeft',
['b_2000'] = 'Space',
['b_1013'] = 'ControlLeft',
['b_1002'] = 'Tab',
['b_1014'] = 'ControlRight',
['b_140'] = 'Numpad4',
['b_142'] = 'Numpad6',
['b_144'] = 'Numpad8',
['b_141'] = 'Numpad5',
['b_143'] = 'Numpad7',
['b_145'] = 'Numpad9',
['b_200'] = 'Insert',
['b_1012'] = 'CapsLock',
['b_170'] = 'F1',
['b_171'] = 'F2',
['b_172'] = 'F3',
['b_173'] = 'F4',
['b_174'] = 'F5',
['b_175'] = 'F6',
['b_176'] = 'F7',
['b_177'] = 'F8',
['b_178'] = 'F9',
['b_179'] = 'F10',
['b_180'] = 'F11',
['b_181'] = 'F12',
['b_194'] = 'ArrowUp',
['b_195'] = 'ArrowDown',
['b_196'] = 'ArrowLeft',
['b_197'] = 'ArrowRight',
['b_1003'] = 'Enter',
['b_1004'] = 'Backspace',
['b_198'] = 'Delete',
['b_199'] = 'Escape',
['b_1009'] = 'PageUp',
['b_1010'] = 'PageDown',
['b_1008'] = 'Home',
['b_131'] = 'NumpadAdd',
['b_130'] = 'NumpadSubstract',
['b_211'] = 'Insert',
['b_210'] = 'Delete',
['b_212'] = 'End',
['b_1055'] = 'Home',
['b_1056'] = 'PageUp',
}
local function translateKey(key)
if string.find(key, "t_") then
return string.gsub(key, "t_", "")
elseif SpecialKeyCodes[key] then
return SpecialKeyCodes[key]
else
return key
end
end
function Utility.GetCommandKey(commandName)
local hash = GetHashKey(commandName) | 0x80000000
local button = GetControlInstructionalButton(2, hash, true)
if not button or button == "" or button == "NULL" then
hash = GetHashKey(commandName)
button = GetControlInstructionalButton(2, hash, true)
end
return translateKey(button)
end
AddEventHandler('onResourceStop', function(resource)
if resource ~= GetCurrentResourceName() then return end
for _, blip in pairs(blipIDs) do
+4 -41
View File
@@ -5,7 +5,6 @@ Clothing.Players = {}
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
Table = Table or Require('lib/utility/shared/tables.lua')
ESX = ESX or exports['es_extended']:getSharedObject()
---Internal function to get the full appearance data including skin, model, and converted format
---@param src number The server ID of the player
@@ -13,9 +12,7 @@ ESX = ESX or exports['es_extended']:getSharedObject()
function Clothing.GetFullAppearanceData(src)
src = src and tonumber(src)
assert(src, "src is nil")
local Player = ESX.GetPlayerFromId(src)
if not Player then return end
local citId = Player.identifier
local citId = Bridge.Framework.GetPlayerIdentifier(src)
if not citId then return end
if Clothing.Players[citId] then return Clothing.Players[citId] end
@@ -55,9 +52,7 @@ end
function Clothing.Save(src)
src = src and tonumber(src)
assert(src, "src is nil")
local Player = ESX.GetPlayerFromId(src)
if not Player then return end
local citId = Player.identifier
local citId = Bridge.Framework.GetPlayerIdentifier(src)
if not citId then return end
local currentClothing = Clothing.GetFullAppearanceData(src)
if not currentClothing then return end
@@ -76,9 +71,7 @@ end
function Clothing.SetAppearance(src, data, updateBackup, save)
src = src and tonumber(src)
assert(src, "src is nil")
local Player = ESX.GetPlayerFromId(src)
if not Player then return end
local citId = Player.identifier
local citId = Bridge.Framework.GetPlayerIdentifier(src)
if not citId then return end
local model = GetEntityModel(GetPlayerPed(src))
if not model then return end
@@ -162,8 +155,6 @@ AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
Clothing.Players[strSrc] = nil
end)
---Event handler for when the resource starts
---Caches appearance data for all currently connected players
AddEventHandler('onResourceStart', function(resource)
@@ -181,32 +172,4 @@ end)
Callback.Register('community_bridge:cb:GetAppearance', function(source)
local src = source
return Clothing.GetAppearance(src)
end)
RegisterCommand('clothing:debug', function(source, args, rawCommand)
local src = source
Clothing.SetAppearance(src, {
components ={
{component_id = 1, drawable = math.random(0, 50), texture = 0},
{component_id = 2, drawable = math.random(0, 50), texture = 0},
{component_id = 3, drawable = math.random(0, 50), texture = 0},
{component_id = 4, drawable = math.random(0, 50), texture = 0},
{component_id = 5, drawable = math.random(0, 50), texture = 0},
{component_id = 6, drawable = math.random(0, 50), texture = 0},
{component_id = 7, drawable = math.random(0, 50), texture = 0},
{component_id = 8, drawable = math.random(0, 50), texture = 0},
},
props = {
{prop_id = 3, drawable = 0, texture = 0},
{prop_id = 1, drawable = 0, texture = 0},
{prop_id = 2, drawable = 0, texture = 0},
}
})
end, false)
RegisterCommand('clothing:revert', function(source, args, rawCommand)
local src = source
Clothing.Revert(src)
end, false)
end)
+27 -1
View File
@@ -130,6 +130,23 @@ Framework.GetPlayerInventory = function()
return playerData.inventory
end
---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@param _type string
---@return number
Framework.GetAccountBalance = function(_type)
local player = Framework.GetPlayerData()
if not player then return 0 end
local accounts = player.accounts
if _type == 'cash' then _type = 'money' end
for _, account in ipairs(accounts) do
if account.name == _type then
return account.money or 0
end
end
return 0
end
---This will return the vehicle properties for the specified vehicle.
---@param vehicle number
---@return table
@@ -158,7 +175,16 @@ Framework.SetVehicleProperties = function(vehicle, properties)
end
end
end
return true, QBCore.Functions.SetVehicleProperties(vehicle, properties)
-- Every framework version does this just a diffrent key I guess?
if properties.color1 and type(properties.color1) == 'table' then
properties.customPrimaryColor = {properties.color1[1], properties.color1[2], properties.color1[3]}
properties.color1 = nil
end
if properties.color2 and type(properties.color2) == 'table' then
properties.customSecondaryColor = {properties.color2[1], properties.color2[2], properties.color2[3]}
properties.color2 = nil
end
return true, ESX.Game.SetVehicleProperties(vehicle, properties)
end
---This will get a players dead status.
+11 -6
View File
@@ -304,7 +304,8 @@ Framework.SetPlayerDuty = function(src, dutystatus)
if not xPlayer then return false end
local job = xPlayer.getJob()
if not job.onDuty then return false end
return xPlayer.setJob(job.name, job.grade, dutystatus)
xPlayer.setJob(job.name, job.grade, dutystatus)
return true
end
---This will get a table of player sources that have the specified job name.
@@ -334,7 +335,8 @@ Framework.SetPlayerJob = function(src, name, grade)
Prints.Error("Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade)
return
end
return xPlayer.setJob(name, grade, true)
xPlayer.setJob(name, grade, true)
return true
end
---This will add money based on the type of account (money/bank)
@@ -346,7 +348,8 @@ Framework.AddAccountBalance = function(src, _type, amount)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
if _type == 'cash' then _type = 'money' end
return xPlayer.addAccountMoney(_type, amount)
xPlayer.addAccountMoney(_type, amount)
return true
end
---This will remove money based on the type of account (money/bank)
@@ -384,7 +387,8 @@ end
Framework.AddItem = function(src, item, amount, slot, metadata)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
return xPlayer.addInventoryItem(item, amount)
xPlayer.addInventoryItem(item, amount)
return true
end
-- Framework.RemoveItem(src, item, amount, slot, metadata)
@@ -398,7 +402,8 @@ end
Framework.RemoveItem = function(src, item, amount, slot, metadata)
local xPlayer = Framework.GetPlayer(src)
if not xPlayer then return end
return xPlayer.removeInventoryItem(item, amount)
xPlayer.removeInventoryItem(item, amount)
return true
end
---This will get all owned vehicles for the player
@@ -462,4 +467,4 @@ Framework.Commands.Add = function(name, help, arguments, argsrequired, callback,
})
end
return Framework
return Framework
+12
View File
@@ -73,6 +73,18 @@ Framework.HideHelpText = function()
return exports['qb-core']:HideText()
end
---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@param _type string
---@return number
Framework.GetAccountBalance = function(_type)
local player = Framework.GetPlayerData()
if not player then return 0 end
local account = player.money
if _type == 'money' then _type = 'cash' end
return account[_type] or 0
end
---This will return the item data for the specified item.
---@param item string
---@return table
+12
View File
@@ -108,6 +108,18 @@ Framework.GetPlayerInventory = function()
return Framework.GetPlayerData().items
end
---This will return the players money by type, I recommend not useing this as its the client and not secure or to be trusted.
---Use case is for a ui or a menu I guess.
---@param _type string
---@return number
Framework.GetAccountBalance = function(_type)
local player = Framework.GetPlayerData()
if not player then return 0 end
local account = player.money
if _type == 'money' then _type = 'cash' end
return account[_type] or 0
end
---This will return the vehicle properties for the specified vehicle.
---@param vehicle number
---@return table
+1 -1
View File
@@ -10,7 +10,7 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
---@return nil
HelpText.ShowHelpText = function(message, position)
return exports.ox_lib:showTextUI(message, {
position = position or 'top-center'
position = position or 'right-center'
})
end
+2 -2
View File
@@ -153,7 +153,7 @@ end
---@param src number
---@param shopTitle string
Inventory.OpenShop = function(src, shopTitle)
return false, Prints.Error("This Inventory Has Not Been Bridged For A OpenShop Feature.")
return Bridge.Shops.OpenShop(src, shopTitle)
end
-- This will register a shop, if it already exists it will return true.
@@ -162,7 +162,7 @@ end
---@param shopCoords table
---@param shopGroups table
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
return false, Prints.Error("This Inventory Has Not Been Bridged For A CreateShop Feature.")
return Bridge.Shops.CreateShop(shopTitle, shopInventory, shopCoords, shopGroups)
end
---This will get the image path for an item, it is an alternate option to GetItemInfo. If a image isnt found will revert to community_bridge logo (useful for menus)
@@ -55,7 +55,7 @@ Inventory.GetPlayerInventory = function()
table.insert(repack, {
name = v.name,
label = v.label,
count = v.count,
count = v.amount,
slot = v.slot,
metadata = v.metadata,
stack = v.unique,
+22 -8
View File
@@ -99,14 +99,28 @@ end
---@param metadata table
---@return number
Inventory.GetItemCount = function(src, item, metadata)
return origin:getItemCount(src, item, metadata, false)
return origin:getItemCount(src, item, metadata, false) or 0
end
---This wil return the players inventory.
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src)
return origin:GetInventory(src)
local playerInv = origin:GetInventory(src)
local inv = playerInv.inventory or {}
local repack = {}
for _, v in pairs(inv) do
if v.slot then
table.insert(repack, {
name = v.name,
count = v.amount,
metadata = v.metadata or {},
slot = v.slot,
label = v.label or "Unknown"
})
end
end
return repack
end
---Returns the specified slot data as a table.
@@ -115,16 +129,16 @@ end
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot)
local inv = origin:getInventory(src)
for k, v in pairs(inv) do
local playerInv = Inventory.GetPlayerInventory(src)
for _, v in pairs(playerInv) do
if v.slot == slot then
return {
weight = v.weight,
name = v.name,
count = v.count,
weight = v.weight or 0,
metadata = v.metadata,
slot = v.slot,
label = v.label,
count = v.count
label = v.label
}
end
end
@@ -144,7 +158,7 @@ end
---This will open the specified stash for the src passed.
---@param src number
---@param _type string
---@param id number||string
---@param id number|string
---@return nil
Inventory.OpenStash = function(src, _type, id)
_type = _type or "stash"
+2
View File
@@ -26,6 +26,8 @@ function OxToQBMenu(id, menu)
event = "community_bridge:client:MenuCallback",
args = {id = id, selected = i, args = v.args, onSelect = v.onSelect},
}
else
button.params = {} -- should fix nil errors when no onSelect is provided
end
table.insert(qbMenu, button)
+2 -1
View File
@@ -15,7 +15,8 @@ end
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['mythic_notify']:SendAlert('inform', message, time)
_type = _type or "inform"
return exports['mythic_notify']:SendAlert(_type, message, time)
end
return Notify
+1 -1
View File
@@ -16,7 +16,7 @@ end
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports.ox_lib:notify({ description = message, type = _type, position = 'center-left' })
return exports.ox_lib:notify({ description = message, type = _type, duration = time, position = 'top-right' })
end
return Notify
+2 -1
View File
@@ -15,7 +15,8 @@ end
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, })
_type = _type or "info"
return exports['t-notify']:Alert({ style = _type, message = message, duration = time, })
end
return Notify
+1
View File
@@ -15,6 +15,7 @@ end
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
_type = _type or "info"
return exports.wasabi_notify:notify(_type, message, time, _type)
end
+15 -2
View File
@@ -79,12 +79,25 @@ Target.AddLocalEntity = function(entities, options)
end
---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 any
---@param labels string | table | nil
---@param entities table
---@param optionNames string | table | nil
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.
---@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 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
+14
View File
@@ -95,6 +95,20 @@ 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