20 files changed
+243
-141
No files matched your search
@@ -12,20 +12,31 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install jq
|
- name: Install dependencies
|
||||||
run: sudo apt-get update && sudo apt-get install -y jq
|
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
|
- name: Send webhook notification
|
||||||
env:
|
env:
|
||||||
WEBHOOK_URL: ${{ secrets.RELEASE_WEBHOOK_URL }}
|
WEBHOOK_URL: ${{ secrets.RELEASE_WEBHOOK_URL }}
|
||||||
run: |
|
run: |
|
||||||
# Extract repository name and release details
|
|
||||||
REPO_NAME=$(basename "$GITHUB_REPOSITORY")
|
REPO_NAME=$(basename "$GITHUB_REPOSITORY")
|
||||||
RELEASE_VERSION=$(jq -r '.release.tag_name // "Unknown Version"' "$GITHUB_EVENT_PATH")
|
RELEASE_VERSION=$(jq -r '.release.tag_name // "Unknown Version"' "$GITHUB_EVENT_PATH")
|
||||||
TITLE="$REPO_NAME $RELEASE_VERSION"
|
TITLE="$REPO_NAME $RELEASE_VERSION"
|
||||||
DESCRIPTION=$(jq -r '.release.body // "No description provided."' "$GITHUB_EVENT_PATH")
|
DESCRIPTION=$(jq -r '.release.body // "No description provided."' "$GITHUB_EVENT_PATH")
|
||||||
|
|
||||||
# Construct JSON payload
|
|
||||||
PAYLOAD=$(jq -n \
|
PAYLOAD=$(jq -n \
|
||||||
--arg title "$TITLE" \
|
--arg title "$TITLE" \
|
||||||
--arg description "$DESCRIPTION" \
|
--arg description "$DESCRIPTION" \
|
||||||
@@ -57,17 +68,15 @@ jobs:
|
|||||||
"type": 2,
|
"type": 2,
|
||||||
"style": 5,
|
"style": 5,
|
||||||
"label": "Get The Latest Community Bridge Release",
|
"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"
|
echo "$PAYLOAD"
|
||||||
|
|
||||||
# Send webhook
|
|
||||||
curl -X POST "$WEBHOOK_URL" \
|
curl -X POST "$WEBHOOK_URL" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
--data-raw "$PAYLOAD" || exit 1
|
--data-raw "$PAYLOAD" || exit 1
|
||||||
@@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
*A modular, beginner-friendly collection of tools and systems designed to simplify and unify FiveM development.*
|
*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
|
## 🚀 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.
|
**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."
|
> "Connecting what matters — frameworks unified, development simplified."
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ use_experimental_fxv2_oal 'yes'
|
|||||||
author 'The Order of the Sacred Framework'
|
author 'The Order of the Sacred Framework'
|
||||||
name 'community_bridge'
|
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.'
|
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 {
|
shared_scripts {
|
||||||
'@ox_lib/init.lua',
|
'@ox_lib/init.lua',
|
||||||
|
|||||||
@@ -541,6 +541,87 @@ function Utility.GetZoneName(coords)
|
|||||||
return GetLabelText(zoneHash)
|
return GetLabelText(zoneHash)
|
||||||
end
|
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)
|
AddEventHandler('onResourceStop', function(resource)
|
||||||
if resource ~= GetCurrentResourceName() then return end
|
if resource ~= GetCurrentResourceName() then return end
|
||||||
for _, blip in pairs(blipIDs) do
|
for _, blip in pairs(blipIDs) do
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ Clothing.Players = {}
|
|||||||
|
|
||||||
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
Callback = Callback or Require("lib/utility/shared/callbacks.lua")
|
||||||
Table = Table or Require('lib/utility/shared/tables.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
|
---Internal function to get the full appearance data including skin, model, and converted format
|
||||||
---@param src number The server ID of the player
|
---@param src number The server ID of the player
|
||||||
@@ -13,9 +12,7 @@ ESX = ESX or exports['es_extended']:getSharedObject()
|
|||||||
function Clothing.GetFullAppearanceData(src)
|
function Clothing.GetFullAppearanceData(src)
|
||||||
src = src and tonumber(src)
|
src = src and tonumber(src)
|
||||||
assert(src, "src is nil")
|
assert(src, "src is nil")
|
||||||
local Player = ESX.GetPlayerFromId(src)
|
local citId = Bridge.Framework.GetPlayerIdentifier(src)
|
||||||
if not Player then return end
|
|
||||||
local citId = Player.identifier
|
|
||||||
if not citId then return end
|
if not citId then return end
|
||||||
|
|
||||||
if Clothing.Players[citId] then return Clothing.Players[citId] end
|
if Clothing.Players[citId] then return Clothing.Players[citId] end
|
||||||
@@ -55,9 +52,7 @@ end
|
|||||||
function Clothing.Save(src)
|
function Clothing.Save(src)
|
||||||
src = src and tonumber(src)
|
src = src and tonumber(src)
|
||||||
assert(src, "src is nil")
|
assert(src, "src is nil")
|
||||||
local Player = ESX.GetPlayerFromId(src)
|
local citId = Bridge.Framework.GetPlayerIdentifier(src)
|
||||||
if not Player then return end
|
|
||||||
local citId = Player.identifier
|
|
||||||
if not citId then return end
|
if not citId then return end
|
||||||
local currentClothing = Clothing.GetFullAppearanceData(src)
|
local currentClothing = Clothing.GetFullAppearanceData(src)
|
||||||
if not currentClothing then return end
|
if not currentClothing then return end
|
||||||
@@ -76,9 +71,7 @@ end
|
|||||||
function Clothing.SetAppearance(src, data, updateBackup, save)
|
function Clothing.SetAppearance(src, data, updateBackup, save)
|
||||||
src = src and tonumber(src)
|
src = src and tonumber(src)
|
||||||
assert(src, "src is nil")
|
assert(src, "src is nil")
|
||||||
local Player = ESX.GetPlayerFromId(src)
|
local citId = Bridge.Framework.GetPlayerIdentifier(src)
|
||||||
if not Player then return end
|
|
||||||
local citId = Player.identifier
|
|
||||||
if not citId then return end
|
if not citId then return end
|
||||||
local model = GetEntityModel(GetPlayerPed(src))
|
local model = GetEntityModel(GetPlayerPed(src))
|
||||||
if not model then return end
|
if not model then return end
|
||||||
@@ -162,8 +155,6 @@ AddEventHandler('community_bridge:Server:OnPlayerUnload', function(src)
|
|||||||
Clothing.Players[strSrc] = nil
|
Clothing.Players[strSrc] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---Event handler for when the resource starts
|
---Event handler for when the resource starts
|
||||||
---Caches appearance data for all currently connected players
|
---Caches appearance data for all currently connected players
|
||||||
AddEventHandler('onResourceStart', function(resource)
|
AddEventHandler('onResourceStart', function(resource)
|
||||||
@@ -182,31 +173,3 @@ Callback.Register('community_bridge:cb:GetAppearance', function(source)
|
|||||||
local src = source
|
local src = source
|
||||||
return Clothing.GetAppearance(src)
|
return Clothing.GetAppearance(src)
|
||||||
end)
|
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)
|
|
||||||
|
|
||||||
@@ -130,6 +130,23 @@ Framework.GetPlayerInventory = function()
|
|||||||
return playerData.inventory
|
return playerData.inventory
|
||||||
end
|
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.
|
---This will return the vehicle properties for the specified vehicle.
|
||||||
---@param vehicle number
|
---@param vehicle number
|
||||||
---@return table
|
---@return table
|
||||||
@@ -158,7 +175,16 @@ Framework.SetVehicleProperties = function(vehicle, properties)
|
|||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
---This will get a players dead status.
|
---This will get a players dead status.
|
||||||
|
|||||||
@@ -304,7 +304,8 @@ Framework.SetPlayerDuty = function(src, dutystatus)
|
|||||||
if not xPlayer then return false end
|
if not xPlayer then return false end
|
||||||
local job = xPlayer.getJob()
|
local job = xPlayer.getJob()
|
||||||
if not job.onDuty then return false end
|
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
|
end
|
||||||
|
|
||||||
---This will get a table of player sources that have the specified job name.
|
---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)
|
Prints.Error("Job Does Not Exsist In Framework :NAME " .. name .. " Grade:" .. grade)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return xPlayer.setJob(name, grade, true)
|
xPlayer.setJob(name, grade, true)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will add money based on the type of account (money/bank)
|
---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)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return end
|
||||||
if _type == 'cash' then _type = 'money' end
|
if _type == 'cash' then _type = 'money' end
|
||||||
return xPlayer.addAccountMoney(_type, amount)
|
xPlayer.addAccountMoney(_type, amount)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will remove money based on the type of account (money/bank)
|
---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)
|
Framework.AddItem = function(src, item, amount, slot, metadata)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return end
|
||||||
return xPlayer.addInventoryItem(item, amount)
|
xPlayer.addInventoryItem(item, amount)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Framework.RemoveItem(src, item, amount, slot, metadata)
|
-- Framework.RemoveItem(src, item, amount, slot, metadata)
|
||||||
@@ -398,7 +402,8 @@ end
|
|||||||
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
Framework.RemoveItem = function(src, item, amount, slot, metadata)
|
||||||
local xPlayer = Framework.GetPlayer(src)
|
local xPlayer = Framework.GetPlayer(src)
|
||||||
if not xPlayer then return end
|
if not xPlayer then return end
|
||||||
return xPlayer.removeInventoryItem(item, amount)
|
xPlayer.removeInventoryItem(item, amount)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will get all owned vehicles for the player
|
---This will get all owned vehicles for the player
|
||||||
|
|||||||
@@ -73,6 +73,18 @@ Framework.HideHelpText = function()
|
|||||||
return exports['qb-core']:HideText()
|
return exports['qb-core']:HideText()
|
||||||
end
|
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.
|
---This will return the item data for the specified item.
|
||||||
---@param item string
|
---@param item string
|
||||||
---@return table
|
---@return table
|
||||||
|
|||||||
@@ -108,6 +108,18 @@ Framework.GetPlayerInventory = function()
|
|||||||
return Framework.GetPlayerData().items
|
return Framework.GetPlayerData().items
|
||||||
end
|
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.
|
---This will return the vehicle properties for the specified vehicle.
|
||||||
---@param vehicle number
|
---@param vehicle number
|
||||||
---@return table
|
---@return table
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (c
|
|||||||
---@return nil
|
---@return nil
|
||||||
HelpText.ShowHelpText = function(message, position)
|
HelpText.ShowHelpText = function(message, position)
|
||||||
return exports.ox_lib:showTextUI(message, {
|
return exports.ox_lib:showTextUI(message, {
|
||||||
position = position or 'top-center'
|
position = position or 'right-center'
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ end
|
|||||||
---@param src number
|
---@param src number
|
||||||
---@param shopTitle string
|
---@param shopTitle string
|
||||||
Inventory.OpenShop = function(src, shopTitle)
|
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
|
end
|
||||||
|
|
||||||
-- This will register a shop, if it already exists it will return true.
|
-- This will register a shop, if it already exists it will return true.
|
||||||
@@ -162,7 +162,7 @@ end
|
|||||||
---@param shopCoords table
|
---@param shopCoords table
|
||||||
---@param shopGroups table
|
---@param shopGroups table
|
||||||
Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
|
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
|
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)
|
---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, {
|
table.insert(repack, {
|
||||||
name = v.name,
|
name = v.name,
|
||||||
label = v.label,
|
label = v.label,
|
||||||
count = v.count,
|
count = v.amount,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata,
|
||||||
stack = v.unique,
|
stack = v.unique,
|
||||||
|
|||||||
@@ -99,14 +99,28 @@ end
|
|||||||
---@param metadata table
|
---@param metadata table
|
||||||
---@return number
|
---@return number
|
||||||
Inventory.GetItemCount = function(src, item, metadata)
|
Inventory.GetItemCount = function(src, item, metadata)
|
||||||
return origin:getItemCount(src, item, metadata, false)
|
return origin:getItemCount(src, item, metadata, false) or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
---This wil return the players inventory.
|
---This wil return the players inventory.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
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
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---Returns the specified slot data as a table.
|
||||||
@@ -115,16 +129,16 @@ end
|
|||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local inv = origin:getInventory(src)
|
local playerInv = Inventory.GetPlayerInventory(src)
|
||||||
for k, v in pairs(inv) do
|
for _, v in pairs(playerInv) do
|
||||||
if v.slot == slot then
|
if v.slot == slot then
|
||||||
return {
|
return {
|
||||||
weight = v.weight,
|
|
||||||
name = v.name,
|
name = v.name,
|
||||||
|
count = v.count,
|
||||||
|
weight = v.weight or 0,
|
||||||
metadata = v.metadata,
|
metadata = v.metadata,
|
||||||
slot = v.slot,
|
slot = v.slot,
|
||||||
label = v.label,
|
label = v.label
|
||||||
count = v.count
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -144,7 +158,7 @@ end
|
|||||||
---This will open the specified stash for the src passed.
|
---This will open the specified stash for the src passed.
|
||||||
---@param src number
|
---@param src number
|
||||||
---@param _type string
|
---@param _type string
|
||||||
---@param id number||string
|
---@param id number|string
|
||||||
---@return nil
|
---@return nil
|
||||||
Inventory.OpenStash = function(src, _type, id)
|
Inventory.OpenStash = function(src, _type, id)
|
||||||
_type = _type or "stash"
|
_type = _type or "stash"
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ function OxToQBMenu(id, menu)
|
|||||||
event = "community_bridge:client:MenuCallback",
|
event = "community_bridge:client:MenuCallback",
|
||||||
args = {id = id, selected = i, args = v.args, onSelect = v.onSelect},
|
args = {id = id, selected = i, args = v.args, onSelect = v.onSelect},
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
button.params = {} -- should fix nil errors when no onSelect is provided
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(qbMenu, button)
|
table.insert(qbMenu, button)
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ end
|
|||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotify = function(message, _type, time)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -16,7 +16,7 @@ end
|
|||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotify = function(message, _type, time)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -15,7 +15,8 @@ end
|
|||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotify = function(message, _type, time)
|
||||||
time = time or 3000
|
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
|
end
|
||||||
|
|
||||||
return Notify
|
return Notify
|
||||||
@@ -15,6 +15,7 @@ end
|
|||||||
---@return nil
|
---@return nil
|
||||||
Notify.SendNotify = function(message, _type, time)
|
Notify.SendNotify = function(message, _type, time)
|
||||||
time = time or 3000
|
time = time or 3000
|
||||||
|
_type = _type or "info"
|
||||||
return exports.wasabi_notify:notify(_type, message, time, _type)
|
return exports.wasabi_notify:notify(_type, message, time, _type)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -79,12 +79,25 @@ Target.AddLocalEntity = function(entities, options)
|
|||||||
end
|
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.
|
---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 entities table
|
||||||
---@param labels string | table | nil
|
---@param optionNames string | table | nil
|
||||||
Target.RemoveLocalEntity = function(entities, optionNames)
|
Target.RemoveLocalEntity = function(entities, optionNames)
|
||||||
ox_target:removeLocalEntity(entities, optionNames)
|
ox_target:removeLocalEntity(entities, optionNames)
|
||||||
end
|
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.
|
---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 models number | table
|
||||||
---@param options table
|
---@param options table
|
||||||
|
|||||||
@@ -95,6 +95,20 @@ Target.RemoveLocalEntity = function(entity, labels)
|
|||||||
qb_target:RemoveTargetEntity(entity, labels)
|
qb_target:RemoveTargetEntity(entity, labels)
|
||||||
end
|
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.
|
---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 models number | table
|
||||||
---@param options table
|
---@param options table
|
||||||
|
|||||||
Reference in new issue
Block a user