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

Dev into main
This commit is contained in:
MrNewb authored and GitHub committed 2025-04-19 15:44:52 -04:00
commit c67c0a817f
72 files changed
+797 -237

No files matched your search

+2
View File
@@ -28,6 +28,7 @@ server_scripts {
'modules/clothing/**/server.lua', 'modules/clothing/**/server.lua',
'modules/shops/**/server.lua', 'modules/shops/**/server.lua',
'modules/notify/**/server.lua', 'modules/notify/**/server.lua',
'modules/housing/**/server.lua',
'init.lua', 'init.lua',
} }
@@ -50,6 +51,7 @@ client_scripts {
'modules/notify/**/client.lua', 'modules/notify/**/client.lua',
'modules/dialogue/**/client/*.lua', 'modules/dialogue/**/client/*.lua',
'modules/shops/**/client.lua', 'modules/shops/**/client.lua',
'modules/housing/**/client.lua',
'modules/accessibility/client.lua', 'modules/accessibility/client.lua',
'init.lua', 'init.lua',
} }
+2 -1
View File
@@ -53,6 +53,7 @@ Bridge.RegisterModule("Doorlock", Doorlock)
Bridge.RegisterModule("Phone", Phone) Bridge.RegisterModule("Phone", Phone)
Bridge.RegisterModule("Dispatch", Dispatch) Bridge.RegisterModule("Dispatch", Dispatch)
Bridge.RegisterModule("Shops", Shops) Bridge.RegisterModule("Shops", Shops)
Bridge.RegisterModule("Housing", Housing)
--lib --lib
Bridge.RegisterModule("Tables", cLib.Tables) Bridge.RegisterModule("Tables", cLib.Tables)
@@ -109,7 +110,7 @@ Bridge.RegisterModule("Raycast", cLib.Raycast)
Bridge.RegisterModule("PlaceableObject", cLib.PlaceableObject) Bridge.RegisterModule("PlaceableObject", cLib.PlaceableObject)
Bridge.RegisterModule("Point", cLib.Point) Bridge.RegisterModule("Point", cLib.Point)
Bridge.RegisterModule("Object", cLib.Object) Bridge.RegisterModule("Object", cLib.Object)
Bridge.RegisterModule("Particle", cLib.Particle)
-- Fill the bridge tables with player data. -- Fill the bridge tables with player data.
+1 -20
View File
@@ -1,8 +1,6 @@
-- Objects -- Objects
Ids = Ids or Require("lib/utility/shared/ids.lua") Ids = Ids or Require("lib/utility/shared/ids.lua")
local Entities = {} local Entities = {}
EntityRelay = {} EntityRelay = {}
@@ -45,21 +43,4 @@ function EntityRelay.LoadModel(model)
return Utility.LoadModel(model) return Utility.LoadModel(model)
end end
return EntityRelay return EntityRelay
-- RegisterCommand("entityobj", function()
-- local entity = Bridge.Object.Create({
-- id = "something", -- optional
-- model = "prop_beach_fire",
-- coords = GetEntityCoords(PlayerPedId()),
-- rotation = vector3(0.0, 0.0, 0.0),
-- })
-- Bridge.Object.SetOnSpawn("something", function(self, coords, rotation)
-- print("Entity spawned")
-- end)
-- Bridge.Object.SetOnRemove("something", function(self, entity)
-- print("Entity removed")
-- end)
-- end)
+1
View File
@@ -67,6 +67,7 @@ cLib.Utility = Utility or Require("lib/utility/client/utility.lua")
cLib.PlaceableObject = PlaceableObject or Require("lib/placers/client/placeable_object.lua") cLib.PlaceableObject = PlaceableObject or Require("lib/placers/client/placeable_object.lua")
cLib.Raycast = Raycast or Require("lib/raycast/client/raycast.lua") cLib.Raycast = Raycast or Require("lib/raycast/client/raycast.lua")
cLib.Point = Point or Require("lib/points/client/points.lua") cLib.Point = Point or Require("lib/points/client/points.lua")
cLib.Particle = Particle or Require("lib/particles/client/particles.lua")
cLib.Object = Object or Require("lib/entities/client/entity_object.lua") cLib.Object = Object or Require("lib/entities/client/entity_object.lua")
return cLib return cLib
+1 -1
View File
@@ -49,7 +49,7 @@ Logs.Send = function(src, message)
elseif BridgeServerConfig.LogSystem == "qb" then elseif BridgeServerConfig.LogSystem == "qb" then
return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message) return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message)
elseif BridgeServerConfig.LogSystem == "ox" then elseif BridgeServerConfig.LogSystem == "ox" then
return exports.ox_lib:logger(src, GetCurrentResourceName(), message) return lib.logger(src, GetCurrentResourceName(), message)
end end
end end
+52 -31
View File
@@ -1,18 +1,41 @@
function CreateParticleFX(dict, ptfx, pos, rot, scale, color, looped, loopLength) Particle = {}
CreateThread(function()
local failed = 5
while not HasNamedPtfxAssetLoaded(dict) and failed >= 0 do
RequestNamedPtfxAsset(ptfx)
failed = failed - 1
Wait(0)
end
---Loads a ptfx asset into memory.
---@param dict string
---@return boolean
function LoadPtfxAsset(dict)
local failed = 100
while not HasNamedPtfxAssetLoaded(dict) and failed >= 0 do
RequestNamedPtfxAsset(dict)
failed = failed - 1
Wait(100)
end
assert(failed > 0, "Failed to load dict asset: " .. dict)
return HasNamedPtfxAssetLoaded(dict)
end
--- Create a particle effect at the specified position and rotation.
--- @param dict string
--- @param ptfx string
--- @param pos vector3
--- @param rot vector3
--- @param scale number
--- @param color vector3
--- @param looped boolean
--- @param loopLength number|nil
--- @return number|nil ptfxHandle -- The handle of the particle effect, or nil if it failed to create.
function Particle.Create(dict, ptfx, pos, rot, scale, color, looped, loopLength)
LoadPtfxAsset(dict)
CreateThread(function()
UseParticleFxAssetNextCall(dict) UseParticleFxAssetNextCall(dict)
SetParticleFxNonLoopedColour(color.x, color.y, color.z) SetParticleFxNonLoopedColour(color.x, color.y, color.z)
if looped then if looped then
StartParticleFxLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false) StartParticleFxLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false)
Wait(loopLength) if loopLength then
RemoveParticleFxInRange(pos.x, pos.y, pos.z, 0.01) Wait(loopLength)
RemoveParticleFxInRange(pos.x, pos.y, pos.z, 0.01)
end
else else
StartParticleFxNonLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false) StartParticleFxNonLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false)
end end
@@ -20,42 +43,40 @@ function CreateParticleFX(dict, ptfx, pos, rot, scale, color, looped, loopLength
end) end)
end end
function CreateParticleFXOnEntityBone(dict, ptfx, entity, bone, offset, rot, scale, color, looped, loopLength) function Particle.CreateOnEntity(dict, ptfx, entity, offset, rot, scale, color, looped, loopLength)
local failed = 5 LoadPtfxAsset(dict)
while not HasNamedPtfxAssetLoaded(dict) and failed >= 0 do
RequestNamedPtfxAsset(ptfx)
failed = failed - 1
Wait(0)
end
UseParticleFxAssetNextCall(dict) UseParticleFxAssetNextCall(dict)
SetParticleFxNonLoopedColour(color.x, color.y, color.z) SetParticleFxNonLoopedColour(color.x, color.y, color.z)
local bleh = nil local particle = nil
if looped then if looped then
bleh = StartNetworkedParticleFxLoopedOnEntityBone(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, bone, scale, false, false, false) particle = StartNetworkedParticleFxLoopedOnEntity(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale, false, false, false)
if loopLength then if loopLength then
Wait(loopLength) Wait(loopLength)
RemoveParticleFxFromEntity(entity) RemoveParticleFxFromEntity(entity)
end end
else else
bleh = StartNetworkedParticleFxNonLoopedOnEntityBone(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, bone, scale, false, false, false) particle = StartNetworkedParticleFxLoopedOnEntity(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale, false, false, false)
end end
RemoveNamedPtfxAsset(ptfx) RemoveNamedPtfxAsset(ptfx)
return bleh return particle
end end
function PlayParticleFX(dict, name, looped, x, y, z, rotX, rotY, rotZ, scale) function Particle.CreateOnEntityBone(dict, ptfx, entity, bone, offset, rot, scale, color, looped, loopLength)
RequestNamedPtfxAsset(dict) LoadPtfxAsset(dict)
while not HasNamedPtfxAssetLoaded(dict) do
Wait(0)
end
SetPtfxAssetNextCall(dict)
UseParticleFxAssetNextCall(dict) UseParticleFxAssetNextCall(dict)
SetParticleFxNonLoopedColour(color.x, color.y, color.z)
local particle = nil local particle = nil
if looped then if looped then
particle = StartParticleFxLoopedAtCoord(name, x, y, z , rotX, rotY, rotZ, scale) particle = StartNetworkedParticleFxLoopedOnEntityBone(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, bone, scale, false, false, false)
if loopLength then
Wait(loopLength)
RemoveParticleFxFromEntity(entity)
end
else else
particle = StartParticleFxNonLoopedAtCoord(name, x, y, z, rotX, rotY, rotZ, scale, false, false, false) particle = StartNetworkedParticleFxNonLoopedOnEntityBone(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, bone, scale, false, false, false)
end end
RemoveNamedPtfxAsset(ptfx)
return particle return particle
end end
return Particle
-21
View File
@@ -242,25 +242,4 @@ function Point.GetAll()
return ActivePoints return ActivePoints
end end
-- Usage example for checking nearby points
-- --
-- ▀█▀ █▄█ █ ▄▀▀ █ ▄▀▀ █▀ █ █ ▄▀▀ █▄▀ █ █▄ █ ▄▀ █▄█ ▄▀▄ ▀█▀ █▀▄ ▄▀▄ █ █▄ █ ▀█▀ ▄▀▀ █▀ ▄▀▄ █▀▄ ▄▀▀ █▀▄ ▄▀▄ █ █ █ ██▀ ▀▄▀
-- █ █ █ █ ▄█▀ █ ▄█▀ █▀ ▀▄█ ▀▄▄ █ █ █ █ ▀█ ▀▄█ █ █ ▀▄▀ █ ██ █▀ ▀▄▀ █ █ ▀█ █ ▄█▀ █▀ ▀▄▀ █▀▄ ▀▄▄ █▀▄ ▀▄▀ ▀▄▀▄▀ █▄▄ █▄▄ █
--[[
Point.Register("point1", vector3(100, 100, 30), 5.0,
function(point)
print("Entered point1")
end,
function(point)
print("Exited point1")
end,
function(nearbyPoints)
print("Point1 has nearby points:")
for id, point in pairs(nearbyPoints) do
print("- " .. id .. " at distance: " .. #(point.coords - ActivePoints["point1"].coords))
end
end
)
--]]
return Point return Point
@@ -2,6 +2,8 @@ if GetResourceState('doors_creator') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function() Doorlock.GetClosestDoor = function()
return exports["doors_creator"]:getClosestActiveDoor() return exports["doors_creator"]:getClosestActiveDoor()
end end
+4
View File
@@ -2,6 +2,10 @@ if GetResourceState('ox_doorlock') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle) Doorlock.ToggleDoorLock = function(doorID, toggle)
local state = toggle local state = toggle
if state then if state then
+2
View File
@@ -2,6 +2,8 @@ if GetResourceState('qb-doorlock') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function() Doorlock.GetClosestDoor = function()
local closestDoor = exports["qb-doorlock"]:GetClosestDoor() local closestDoor = exports["qb-doorlock"]:GetClosestDoor()
if Table.CheckPopulated(closestDoor) then return closestDoor end if Table.CheckPopulated(closestDoor) then return closestDoor end
+4
View File
@@ -2,6 +2,10 @@ if GetResourceState('qb-doorlock') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle) Doorlock.ToggleDoorLock = function(doorID, toggle)
TriggerClientEvent('qb-doorlock:client:setState', -1, 0, doorID, toggle, false, false, false) TriggerClientEvent('qb-doorlock:client:setState', -1, 0, doorID, toggle, false, false, false)
return true return true
@@ -2,6 +2,8 @@ if GetResourceState('rcore_doorlock') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will get the closest door to the ped
---@return string | nil
Doorlock.GetClosestDoor = function() Doorlock.GetClosestDoor = function()
local allDoors = exports.rcore_doorlock:getLoadedDoors() local allDoors = exports.rcore_doorlock:getLoadedDoors()
local pedCoords = GetEntityCoords(cache.ped) local pedCoords = GetEntityCoords(cache.ped)
@@ -2,6 +2,10 @@ if GetResourceState('rcore_doorlock') ~= 'started' then return end
Doorlock = Doorlock or {} Doorlock = Doorlock or {}
---This will toggle the lock status of the door.
---@param doorID string
---@param toggle boolean
---@return boolean
Doorlock.ToggleDoorLock = function(doorID, toggle) Doorlock.ToggleDoorLock = function(doorID, toggle)
local state = toggle local state = toggle
if state then if state then
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('es_extended') ~= 'started' then return end if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports["es_extended"]:getSharedObject() ESX = exports["es_extended"]:getSharedObject()
+44 -11
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('es_extended') ~= 'started' then return end if GetResourceState('es_extended') ~= 'started' then return end
ESX = exports["es_extended"]:getSharedObject() ESX = exports["es_extended"]:getSharedObject()
@@ -35,6 +36,17 @@ Framework.GetPlayerName = function(src)
return xPlayer.variables.firstName, xPlayer.variables.lastName return xPlayer.variables.firstName, xPlayer.variables.lastName
end end
---This will return a table of all logged in players
---@return table
Framework.GetPlayers = function()
local players = ESX.GetExtendedPlayers()
local playerList = {}
for _, xPlayer in pairs(players) do
table.insert(playerList, xPlayer.source)
end
return playerList
end
-- Framework.GetItem(src, item, metadata) -- Framework.GetItem(src, item, metadata)
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory. -- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
@@ -160,12 +172,41 @@ Framework.GetPlayerPhone = function(src)
return xPlayer.get("phone_number") return xPlayer.get("phone_number")
end end
-- Framework.GetPlayerJob(src)
-- Returns the job name, label, grade name, and grade level of the player. ---Returns the job name, label, grade name, and grade level of the player.
---@param src number
---@return string | nil
---@return string | nil
---@return string | nil
---@return string | nil
Framework.GetPlayerJob = function(src) Framework.GetPlayerJob = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end if not xPlayer then return end
return xPlayer.getJob().name, xPlayer.getJob().label, xPlayer.getJob().grade_label, xPlayer.getJob().grade local job = xPlayer.getJob()
return job.name, job.label, job.grade_label, job.grade
end
---Returns the players duty status.
---@param src number
---@return boolean
Framework.GetPlayerDuty = function(src)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return false end
local job = xPlayer.getJob()
if not job.onDuty then return false end
return true
end
---Sets the players duty status.
---@param src number
---@param dutystatus boolean
---@return boolean
Framework.SetPlayerDuty = function(src, dutystatus)
local xPlayer = ESX.GetPlayerFromId(src)
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)
end end
-- Framework.GetPlayersByJob(jobname) -- Framework.GetPlayersByJob(jobname)
@@ -191,14 +232,6 @@ Framework.SetPlayerJob = function(src, name, grade)
return xPlayer.setJob(name, grade, true) return xPlayer.setJob(name, grade, true)
end end
Framework.ToggleDuty = function(src, status)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
local name = xPlayer.getJob().name
local grade = xPlayer.getJob().grade
xPlayer.setJob(name, grade, status)
end
-- Framework.AddAccountBalance(src, _type, amount) -- Framework.AddAccountBalance(src, _type, amount)
-- Adds the specified amount to the player's account balance of the specified type. -- Adds the specified amount to the player's account balance of the specified type.
Framework.AddAccountBalance = function(src, _type, amount) Framework.AddAccountBalance = function(src, _type, amount)
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-core') ~= 'started' then return end if GetResourceState('qb-core') ~= 'started' then return end
if GetResourceState('qbx_core') == 'started' then return end if GetResourceState('qbx_core') == 'started' then return end
+60 -17
View File
@@ -1,10 +1,11 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qb-core') ~= 'started' then return end if GetResourceState('qb-core') ~= 'started' then return end
if GetResourceState('qbx_core') == 'started' then return end if GetResourceState('qbx_core') == 'started' then return end
QBCore = exports['qb-core']:GetCoreObject() QBCore = exports['qb-core']:GetCoreObject()
Framework = {} Framework = {}
Framework.Shared = QBCore.Shared
Framework.GetFrameworkName = function() Framework.GetFrameworkName = function()
return 'qb-core' return 'qb-core'
end end
@@ -71,6 +72,23 @@ Framework.GetItem = function(src, item, metadata)
return repackedTable return repackedTable
end end
---This will get the data about an item such as name, label, stack, weight, description and image.
---@param item string
---@return table
Framework.GetItemInfo = function(item)
local itemData = QBCore.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = itemData.image
}
return repackedTable
end
-- Framework.GetItemCount(src, item, metadata) -- Framework.GetItemCount(src, item, metadata)
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory. -- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
Framework.GetItemCount = function(src, item, metadata) Framework.GetItemCount = function(src, item, metadata)
@@ -116,6 +134,17 @@ Framework.GetPlayerInventory = function(src)
return repackedTable return repackedTable
end end
---This will return a table of all logged in players
---@return table
Framework.GetPlayers = function()
local players = QBCore.Functions.GetPlayers()
local playerList = {}
for _, src in pairs(players) do
table.insert(playerList, src)
end
return playerList
end
Framework.GetItemBySlot = function(src, slot) Framework.GetItemBySlot = function(src, slot)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end if not player then return end
@@ -193,7 +222,9 @@ Framework.AddHunger = function(src, value)
local playerData = player.PlayerData local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0) + value local newHunger = (playerData.metadata.hunger or 0) + value
player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100)) player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100))
TriggerClientEvent('hud:client:UpdateNeeds', src, newHunger, playerData.metadata.thirst)
--TriggerClientEvent('hud:client:UpdateStress', src, newStress) --TriggerClientEvent('hud:client:UpdateStress', src, newStress)
return newHunger return newHunger
end end
@@ -206,6 +237,7 @@ Framework.AddThirst = function(src, value)
local playerData = player.PlayerData local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0) + value local newThirst = (playerData.metadata.thirst or 0) + value
player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100)) player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100))
TriggerClientEvent('hud:client:UpdateNeeds', src, playerData.metadata.hunger, newThirst)
--TriggerClientEvent('hud:client:UpdateStress', src, newStress) --TriggerClientEvent('hud:client:UpdateStress', src, newStress)
return newThirst return newThirst
end end
@@ -255,8 +287,8 @@ end
---@param job any ---@param job any
---@return table ---@return table
Framework.GetPlayersByJob = function(job) Framework.GetPlayersByJob = function(job)
local players = QBCore.Functions.GetPlayers()
local playerList = {} local playerList = {}
local players = QBCore.Functions.GetPlayers()
for _, src in pairs(players) do for _, src in pairs(players) do
local player = QBCore.Functions.GetPlayer(src).PlayerData local player = QBCore.Functions.GetPlayer(src).PlayerData
if player.job.name == job then if player.job.name == job then
@@ -279,6 +311,28 @@ Framework.GetPlayerJob = function(src)
return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level
end end
---Returns the players duty status.
---@param src number
---@return boolean | nil
Framework.GetPlayerDuty = function(src)
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
if not playerData.job.onduty then return false end
return true
end
---This will toggle a players duty status
---@param src number
---@param status boolean
---@return nil
Framework.SetPlayerDuty = function(src, status)
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
player.Functions.SetJobDuty(status)
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
end
-- Sets the player's job to the specified name and grade. -- Sets the player's job to the specified name and grade.
---@param src number ---@param src number
---@param name string ---@param name string
@@ -290,18 +344,6 @@ Framework.SetPlayerJob = function(src, name, grade)
return player.Functions.SetJob(name, grade) return player.Functions.SetJob(name, grade)
end end
---This will toggle a players duty status
---@param src number
---@param status boolean
---@return nil
Framework.ToggleDuty = function(src, status)
local player = QBCore.Functions.GetPlayer(src)
if not player then return end
player.Functions.SetJobDuty(status)
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
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)
---@param src number ---@param src number
---@param _type string ---@param _type string
@@ -373,8 +415,8 @@ Framework.SetMetadata = function(src, item, slot, metadata)
end end
end end
end end
player.Functions.RemoveItem(item, 1, itemSlot) if not player.Functions.RemoveItem(item, 1, itemSlot) then return false end
return player.Functions.AddItem(item, 1, freeSlot, metadata) return player.Functions.AddItem(item, 1, slot, metadata)
end end
---This will get all owned vehicles for the player ---This will get all owned vehicles for the player
@@ -421,4 +463,5 @@ end)
Framework.Commands = {} Framework.Commands = {}
Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...) Framework.Commands.Add = function(name, help, arguments, argsrequired, callback, permission, ...)
QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...) QBCore.Commands.Add(name, help, arguments, argsrequired, callback, permission, ...)
end end
+1
View File
@@ -1,3 +1,4 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qbx_core') ~= 'started' then return end if GetResourceState('qbx_core') ~= 'started' then return end
QBox = exports.qbx_core QBox = exports.qbx_core
+156 -57
View File
@@ -1,13 +1,19 @@
---@diagnostic disable: duplicate-set-field
if GetResourceState('qbx_core') ~= 'started' then return end if GetResourceState('qbx_core') ~= 'started' then return end
local QBox = exports.qbx_core local QBox = exports.qbx_core
Framework = {} Framework = {}
---Returns the name of the framework being used (if a supported framework).
---@return string
Framework.GetFrameworkName = function() Framework.GetFrameworkName = function()
return 'qbx_core' return 'qbx_core'
end end
---Returns the player date of birth.
---@param src number
---@return string
Framework.GetPlayerDob = function(src) Framework.GetPlayerDob = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -15,12 +21,15 @@ Framework.GetPlayerDob = function(src)
return playerData.charinfo.birthdate return playerData.charinfo.birthdate
end end
---Returns a table of the jobs in the framework.
---@return table
Framework.GetFrameworkJobs = function() Framework.GetFrameworkJobs = function()
return QBox.GetJobs() return QBox.GetJobs()
end end
-- Framework.GetPlayerIdentifier(src) ---Returns the citizen ID of the player.
-- Returns the citizen ID of the player. ---@param src number
---@return string | boolean
Framework.GetPlayerIdentifier = function(src) Framework.GetPlayerIdentifier = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -29,8 +38,20 @@ Framework.GetPlayerIdentifier = function(src)
return playerData.citizenid return playerData.citizenid
end end
-- Framework.GetPlayerName(src) ---This will return a table of all logged in players
-- Returns the first and last name of the player. ---@return table
Framework.GetPlayers = function()
local players = QBox:GetQBPlayers()
local playerList = {}
for src, _ in pairs(players) do
table.insert(playerList, src)
end
return playerList
end
---Returns the first and last name of the player.
---@param src number
---@return string | nil
Framework.GetPlayerName = function(src) Framework.GetPlayerName = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -38,9 +59,11 @@ Framework.GetPlayerName = function(src)
return playerData.charinfo.firstname, playerData.charinfo.lastname return playerData.charinfo.firstname, playerData.charinfo.lastname
end end
-- Framework.GetItem(src, item, metadata)
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory. -- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} ---@param src number
---@param item string
---@param metadata table
---@return table
Framework.GetItem = function(src, item, metadata) Framework.GetItem = function(src, item, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -59,8 +82,11 @@ Framework.GetItem = function(src, item, metadata)
return repackedTable return repackedTable
end end
-- Framework.GetItemCount(src, item, metadata) ---Returns the count of items matching the specified name and if passed metadata from the player's inventory.
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory. ---@param src number
---@param item string
---@param metadata table
---@return number
Framework.GetItemCount = function(src, item, metadata) Framework.GetItemCount = function(src, item, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -74,7 +100,7 @@ Framework.GetItemCount = function(src, item, metadata)
return count return count
end end
---comment ---Returns boolean if the player has the specified item in their inventory.
---@param src number ---@param src number
---@param item string ---@param item string
---@return boolean ---@return boolean
@@ -83,9 +109,9 @@ Framework.HasItem = function(src, item)
return getCount > 0 return getCount > 0
end end
-- Framework.GetPlayerInventory(src) ---Returns the entire inventory of the player as a table.
-- Returns the entire inventory of the player as a table. ---@param src number
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} ---@return table
Framework.GetPlayerInventory = function(src) Framework.GetPlayerInventory = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -102,8 +128,11 @@ Framework.GetPlayerInventory = function(src)
return repackedTable return repackedTable
end end
-- Framework.SetMetadata(src, metadata, value) ---Adds the specified metadata key and number value to the player's data.
-- Adds the specified metadata key and number value to the player's data. ---@param src number
---@param metadata string
---@param value string
---@return boolean
Framework.SetPlayerMetadata = function(src, metadata, value) Framework.SetPlayerMetadata = function(src, metadata, value)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -111,8 +140,10 @@ Framework.SetPlayerMetadata = function(src, metadata, value)
return true return true
end end
-- Framework.GetMetadata(src, metadata) ---Gets the specified metadata key to the player's data.
-- Gets the specified metadata key to the player's data. ---@param src number
---@param metadata string
---@return string | boolean | nil
Framework.GetPlayerMetadata = function(src, metadata) Framework.GetPlayerMetadata = function(src, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -120,8 +151,10 @@ Framework.GetPlayerMetadata = function(src, metadata)
return playerData.metadata[metadata] or false return playerData.metadata[metadata] or false
end end
-- Framework.AddStress(src, value) ---Adds the specified value to the player's stress level and updates the client HUD.
-- Adds the specified value to the player's stress level and updates the client HUD. ---@param src number
---@param value number
---@return number | nil
Framework.AddStress = function(src, value) Framework.AddStress = function(src, value)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -132,8 +165,10 @@ Framework.AddStress = function(src, value)
return newStress return newStress
end end
-- Framework.RemoveStress(src, value) ---Removes the specified value from the player's stress level and updates the client HUD.
-- Removes the specified value from the player's stress level and updates the client HUD. ---@param src number
---@param value number
---@return number | nil
Framework.RemoveStress = function(src, value) Framework.RemoveStress = function(src, value)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -144,8 +179,10 @@ Framework.RemoveStress = function(src, value)
return newStress return newStress
end end
-- Framework.AddHunger(src, value) ---Adds the specified value from the player's hunger level.
-- Adds the specified value from the player's hunger level. ---@param src number
---@param value number
---@return number | nil
Framework.AddHunger = function(src, value) Framework.AddHunger = function(src, value)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -156,8 +193,10 @@ Framework.AddHunger = function(src, value)
return newHunger return newHunger
end end
-- Framework.AddThirst(src, value)
-- Adds the specified value from the player's thirst level. -- Adds the specified value from the player's thirst level.
---@param src number
---@param value number
---@return number | nil
Framework.AddThirst = function(src, value) Framework.AddThirst = function(src, value)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -168,6 +207,9 @@ Framework.AddThirst = function(src, value)
return newThirst return newThirst
end end
---This will return the players hunger level.
---@param src number
---@return number | nil
Framework.GetHunger = function(src) Framework.GetHunger = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -176,6 +218,9 @@ Framework.GetHunger = function(src)
return newHunger return newHunger
end end
---This will return the players thirst level.
---@param src number
---@return number
Framework.GetThirst = function(src) Framework.GetThirst = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -184,8 +229,9 @@ Framework.GetThirst = function(src)
return newThirst return newThirst
end end
-- Framework.GetPlayerPhone(src) ---Returns the phone number of the player.
-- Returns the phone number of the player. ---@param src number
---@return string | nil
Framework.GetPlayerPhone = function(src) Framework.GetPlayerPhone = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -193,13 +239,17 @@ Framework.GetPlayerPhone = function(src)
return playerData.charinfo.phone return playerData.charinfo.phone
end end
-- Framework.GetPlayerGang(src) ---Returns the gang name of the player.
-- Returns the gang name of the player. ---@param src number
---@return string | nil
Framework.GetPlayerGang = function(src) Framework.GetPlayerGang = function(src)
local player = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src).PlayerData
return player.gang.name return player.gang.name
end end
---This will return a table of all players with the specified job.
---@param job string
---@return table
Framework.GetPlayersByJob = function(job) Framework.GetPlayersByJob = function(job)
local playerList = {} local playerList = {}
local players = QBox:GetQBPlayers() local players = QBox:GetQBPlayers()
@@ -211,30 +261,56 @@ Framework.GetPlayersByJob = function(job)
return playerList return playerList
end end
-- Framework.GetPlayerJob(src) ---Returns the job name, label, grade name, and grade level of the player.
-- Returns the job name, label, grade name, and grade level of the player. ---@param src number
---@return string | string | string | number | nil
---@return string | string | string | number | nil
---@return string | string | string | number | nil
---@return string | string | string | number | nil
Framework.GetPlayerJob = function(src) Framework.GetPlayerJob = function(src)
local player = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src).PlayerData
if not player then return end
return player.job.name, player.job.label, player.job.grade.name, player.job.grade.level return player.job.name, player.job.label, player.job.grade.name, player.job.grade.level
end end
-- Framework.SetPlayerJob(src, name, grade) ---Sets the player's job to the specified name and grade.
-- Sets the player's job to the specified name and grade. ---@param src number
---@param name string
---@param grade string
---@return boolean | nil
Framework.SetPlayerJob = function(src, name, grade) Framework.SetPlayerJob = function(src, name, grade)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
return player.Functions.SetJob(name, grade) return player.Functions.SetJob(name, grade)
end end
Framework.ToggleDuty = function(src, status) ---This will toggle the duty status of the player.
---@param src number
---@param status boolean
Framework.SetPlayerDuty = function(src, status)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
QBox:SetJobDuty(playerData.citizenid, status) QBox:SetJobDuty(playerData.citizenid, status)
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
end end
-- Framework.AddAccountBalance(src, _type, amount) ---Returns the players duty status.
-- Adds the specified amount to the player's account balance of the specified type. ---@param src number
---@return boolean | nil
Framework.GetPlayerDuty = function(src)
local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
if not playerData.job.onduty then return false end
return true
end
---Adds the specified amount to the player's account balance of the specified type.
---@param src number
---@param _type string
---@param amount number
---@return boolean | nil
Framework.AddAccountBalance = function(src, _type, amount) Framework.AddAccountBalance = function(src, _type, amount)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -242,8 +318,11 @@ Framework.AddAccountBalance = function(src, _type, amount)
return player.Functions.AddMoney(_type, amount) return player.Functions.AddMoney(_type, amount)
end end
-- Framework.RemoveAccountBalance(src, _type, amount) ---Removes the specified amount from the player's account balance of the specified type.
-- Removes the specified amount from the player's account balance of the specified type. ---@param src number
---@param _type string
---@param amount number
---@return boolean | nil
Framework.RemoveAccountBalance = function(src, _type, amount) Framework.RemoveAccountBalance = function(src, _type, amount)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -251,8 +330,10 @@ Framework.RemoveAccountBalance = function(src, _type, amount)
return player.Functions.RemoveMoney(_type, amount) return player.Functions.RemoveMoney(_type, amount)
end end
-- Framework.GetAccountBalance(src, _type) ---Returns the player's account balance of the specified type.
-- Returns the player's account balance of the specified type. ---@param src number
---@param _type string
---@return number | nil
Framework.GetAccountBalance = function(src, _type) Framework.GetAccountBalance = function(src, _type)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -261,8 +342,13 @@ Framework.GetAccountBalance = function(src, _type)
return playerData.money[_type] return playerData.money[_type]
end end
-- Framework.AddItem(src, item, amount, slot, metadata) ---Adds the specified item to the player's inventory.
-- Adds the specified item to the player's inventory. ---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.AddItem = function(src, item, amount, slot, metadata) Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -270,8 +356,13 @@ Framework.AddItem = function(src, item, amount, slot, metadata)
return player.Functions.AddItem(item, amount, slot, metadata) return player.Functions.AddItem(item, amount, slot, metadata)
end end
-- Framework.RemoveItem(src, item, amount, slot, metadata) ---Removes the specified item from the player's inventory.
-- Removes the specified item from the player's inventory. ---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.RemoveItem = function(src, item, amount, slot, metadata) Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -279,9 +370,12 @@ Framework.RemoveItem = function(src, item, amount, slot, metadata)
return player.Functions.RemoveItem(item, amount, slot) return player.Functions.RemoveItem(item, amount, slot)
end end
-- Framework.SetMetadata(src, item, slot, metadata) ---Sets the metadata for the specified item in the player's inventory.
-- Sets the metadata for the specified item in the player's inventory. -----@param src number
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way ---@param item string
---@param slot number
---@param metadata table
---@return boolean | nil
Framework.SetMetadata = function(src, item, slot, metadata) Framework.SetMetadata = function(src, item, slot, metadata)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end if not player then return end
@@ -289,6 +383,9 @@ Framework.SetMetadata = function(src, item, slot, metadata)
return player.Functions.AddItem(item, 1, slot, metadata) return player.Functions.AddItem(item, 1, slot, metadata)
end end
---Returns a table of owned vehicles for the player. format is {vehicle = vehicle, plate = plate}
---@param src number
---@return table
Framework.GetOwnedVehicles = function(src) Framework.GetOwnedVehicles = function(src)
local citizenId = Framework.GetPlayerIdentifier(src) local citizenId = Framework.GetPlayerIdentifier(src)
local result = MySQL.Sync.fetchAll("SELECT vehicle, plate FROM player_vehicles WHERE citizenid = '" .. citizenId .. "'") local result = MySQL.Sync.fetchAll("SELECT vehicle, plate FROM player_vehicles WHERE citizenid = '" .. citizenId .. "'")
@@ -301,6 +398,19 @@ Framework.GetOwnedVehicles = function(src)
return vehicles return vehicles
end end
---Registers a usable item with a callback function.
---@param itemName string
---@param cb function
---@return function
Framework.RegisterUsableItem = function(itemName, cb)
local func = function(src, item, itemData)
itemData = itemData or item
itemData.metadata = itemData.metadata or itemData.info or {}
cb(src, itemData)
end
return QBox:CreateUseableItem(itemName, func)
end
RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function() RegisterNetEvent("QBCore:Server:OnPlayerLoaded", function()
local src = source local src = source
TriggerEvent("community_bridge:Server:OnPlayerLoaded", src) TriggerEvent("community_bridge:Server:OnPlayerLoaded", src)
@@ -314,15 +424,4 @@ end)
AddEventHandler("playerDropped", function() AddEventHandler("playerDropped", function()
local src = source local src = source
TriggerEvent("community_bridge:Server:OnPlayerUnload", src) TriggerEvent("community_bridge:Server:OnPlayerUnload", src)
end) end)
-- Framework.RegisterUsableItem(item, cb)
-- Registers a usable item with a callback function.
Framework.RegisterUsableItem = function(itemName, cb)
local func = function(src, item, itemData)
itemData = itemData or item
itemData.metadata = itemData.metadata or itemData.info or {}
cb(src, itemData)
end
return QBox:CreateUseableItem(itemName, func)
end
+6
View File
@@ -1,5 +1,11 @@
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return 'default'
end
---This will get the fuel level of the vehicle. ---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID. ---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle. ---@return number fuel The fuel level of the vehicle.
+13 -2
View File
@@ -2,15 +2,26 @@ local resourceName = "BigDaddy-Fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading BigDaddy-Fuel")
--if GetResourceState('BigDaddy-Fuel') ~= 'started' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['BigDaddy-Fuel']:GetFuel(vehicle) return exports['BigDaddy-Fuel']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
exports['BigDaddy-Fuel']:SetFuel(vehicle, fuel) exports['BigDaddy-Fuel']:SetFuel(vehicle, fuel)
+14 -2
View File
@@ -1,15 +1,27 @@
local resourceName = "cdn-fuel" local resourceName = "cdn-fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
----print("Fuel: Loading cdn-fuel")
--if GetResourceState('cdn-fuel') ~= 'started' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['cdn-fuel']:GetFuel(vehicle) return exports['cdn-fuel']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['cdn-fuel']:SetFuel(vehicle, fuel) return exports['cdn-fuel']:SetFuel(vehicle, fuel)
+15 -3
View File
@@ -1,16 +1,28 @@
local resourceName = "esx-sna-fuel" local resourceName = "esx-sna-fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading esx-sna-fuel")
--if GetResourceState('esx-sna-fuel') ~= 'started' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['esx-sna-fuel']:GetFuel(vehicle) return exports['esx-sna-fuel']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
exports['esx-sna-fuel']:SetFuel(vehicle, fuel) exports['esx-sna-fuel']:SetFuel(vehicle, fuel)
end end
+15 -4
View File
@@ -1,17 +1,28 @@
local resourceName = "lc_fuel" local resourceName = "lc_fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading lc_fuel")
if GetResourceState('lc_fuel') ~= 'started' then return end
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports["lc_fuel"]:GetFuel(vehicle) return exports["lc_fuel"]:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports["lc_fuel"]:SetFuel(vehicle, fuel) return exports["lc_fuel"]:SetFuel(vehicle, fuel)
end end
+13 -1
View File
@@ -1,15 +1,27 @@
local resourceName = "LegacyFuel" local resourceName = "LegacyFuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading LegacyFuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['LegacyFuel']:GetFuel(vehicle) return exports['LegacyFuel']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['LegacyFuel']:SetFuel(vehicle, fuel) return exports['LegacyFuel']:SetFuel(vehicle, fuel)
+14 -1
View File
@@ -1,14 +1,27 @@
local resourceName = "okokGasStation" local resourceName = "okokGasStation"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading okokGasStation")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['okokGasStation']:GetFuel(vehicle) return exports['okokGasStation']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['okokGasStation']:SetFuel(vehicle, fuel) return exports['okokGasStation']:SetFuel(vehicle, fuel)
+14 -1
View File
@@ -1,14 +1,27 @@
local resourceName = "ox_fuel" local resourceName = "ox_fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading ox_fuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return Entity(vehicle).state.fuel return Entity(vehicle).state.fuel
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
local currentFuel = Entity(vehicle).state.fuel local currentFuel = Entity(vehicle).state.fuel
+14 -1
View File
@@ -1,14 +1,27 @@
local resourceName = "ps-fuel" local resourceName = "ps-fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading ps-fuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports["ps-fuel"]:GetFuel(vehicle) return exports["ps-fuel"]:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports["ps-fuel"]:SetFuel(vehicle, fuel) return exports["ps-fuel"]:SetFuel(vehicle, fuel)
+15 -2
View File
@@ -1,15 +1,28 @@
local resourceName = "qs-fuelstations" local resourceName = "qs-fuelstations"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading qs-fuelstations")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['qs-fuelstations']:GetFuel(vehicle) return exports['qs-fuelstations']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['qs-fuelstations']:SetFuel(vehicle, fuel) return exports['qs-fuelstations']:SetFuel(vehicle, fuel)
end end
+14 -1
View File
@@ -1,14 +1,27 @@
local resourceName = "Renewed-Fuel" local resourceName = "Renewed-Fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading Renewed-Fuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
return exports['Renewed-Fuel']:GetFuel(vehicle) return exports['Renewed-Fuel']:GetFuel(vehicle)
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel, type) Fuel.SetFuel = function(vehicle, fuel, type)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['Renewed-Fuel']:SetFuel(vehicle, fuel) return exports['Renewed-Fuel']:SetFuel(vehicle, fuel)
+14 -1
View File
@@ -1,15 +1,28 @@
local resourceName = "ti_fuel" local resourceName = "ti_fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading ti_fuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
local level, _ = exports["ti_fuel"]:getFuel(vehicle) local level, _ = exports["ti_fuel"]:getFuel(vehicle)
return level return level
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['ti_fuel']:setFuel(vehicle, fuel, "RON91") return exports['ti_fuel']:setFuel(vehicle, fuel, "RON91")
+14 -1
View File
@@ -1,15 +1,28 @@
local resourceName = "x-fuel" local resourceName = "x-fuel"
local configValue = BridgeClientConfig.Fuel local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading x-fuel")
Fuel = Fuel or {} Fuel = Fuel or {}
---This will get the name of the Fuel being used (if a supported Fuel).
---@return string
Fuel.GetFuelName = function()
return resourceName
end
---This will get the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@return number fuel The fuel level of the vehicle.
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end if not DoesEntityExist(vehicle) then return 0.0 end
local level, _ = exports["x-fuel"]:getFuel(vehicle) local level, _ = exports["x-fuel"]:getFuel(vehicle)
return level return level
end end
---This will set the fuel level of the vehicle.
---@param vehicle number The vehicle entity ID.
---@param fuel number The fuel level to set.
---@return nil
Fuel.SetFuel = function(vehicle, fuel) Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end if not DoesEntityExist(vehicle) then return end
return exports['x-fuel']:SetFuel(vehicle, fuel) return exports['x-fuel']:SetFuel(vehicle, fuel)
+1
View File
@@ -0,0 +1 @@
Housing = Housing or {}
+12
View File
@@ -0,0 +1,12 @@
Housing = Housing or {}
---This is an internal event, listen for 'community_bridge:Client:OnPlayerInside' instead.
---This event is triggered when a player enters or leaves a property.
---@param src number
---@param insideId string
RegisterNetEvent('community_bridge:Server:_OnPlayerInside', function(src, insideId)
local currentBucket = GetPlayerRoutingBucket(src)
local playerEntity = GetPlayerPed(src)
local playerCoords = GetEntityCoords(playerEntity)
TriggerEvent('community_bridge:Client:OnPlayerInside', src, insideId, currentBucket, playerCoords)
end)
+11
View File
@@ -0,0 +1,11 @@
if GetResourceState('bcs-housing') ~= 'started' then return end
Housing = Housing or {}
RegisterNetEvent('Housing:client:EnterHome', function(insideId)
TriggerServerEvent('community_bridge:Server:_OnPlayerInside', insideId)
end)
RegisterNetEvent("Housing:client:DeleteFurnitures", function()
TriggerServerEvent('community_bridge:Server:_OnPlayerInside', false)
end)
+3
View File
@@ -0,0 +1,3 @@
if GetResourceState('bcs-housing') ~= 'started' then return end
Housing = Housing or {}
+3
View File
@@ -0,0 +1,3 @@
if GetResourceState('esx_property') ~= 'started' then return end
Housing = Housing or {}
+13
View File
@@ -0,0 +1,13 @@
if GetResourceState('esx_property') ~= 'started' then return end
Housing = Housing or {}
RegisterNetEvent('esx_property:enter', function(insideId)
local src = source
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
RegisterNetEvent('esx_property:leave', function(insideId)
local src = source
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
+3
View File
@@ -0,0 +1,3 @@
if GetResourceState('ps-housing') ~= 'started' then return end
Housing = Housing or {}
+13
View File
@@ -0,0 +1,13 @@
if GetResourceState('ps-housing') ~= 'started' then return end
Housing = Housing or {}
RegisterNetEvent('ps-housing:server:enterProperty', function(insideId)
local src = source
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
RegisterNetEvent('ps-housing:server:leaveProperty', function(insideId)
local src = source
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
@@ -0,0 +1,3 @@
if GetResourceState('qb-appartments') ~= 'started' then return end
Housing = Housing or {}
@@ -0,0 +1,9 @@
if GetResourceState('qb-appartments') ~= 'started' then return end
Housing = Housing or {}
RegisterNetEvent('qb-apartments:server:SetInsideMeta', function(house, insideId, bool, isVisiting)
local src = source
insideId = bool and house .. '-' .. insideId or nil
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
+3
View File
@@ -0,0 +1,3 @@
if GetResourceState('qb-houses') ~= 'started' then return end
Housing = Housing or {}
+9
View File
@@ -0,0 +1,9 @@
if GetResourceState('qb-houses') ~= 'started' then return end
Housing = Housing or {}
RegisterNetEvent('qb-houses:server:SetInsideMeta', function(insideId, bool)
local src = source
insideId = bool and insideId or nil
TriggerEvent('community_bridge:Server:_OnPlayerInside', src, insideId)
end)
+3 -1
View File
@@ -1,4 +1,6 @@
if GetResourceState('ox_lib') ~= 'started' or (BridgeClientConfig.InputSystem ~= "ox" and BridgeClientConfig.InputSystem ~= "auto") then return end local resourceName = "ox_lib"
local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
function QBTypeToOxType(_type) function QBTypeToOxType(_type)
if _type == "text" then if _type == "text" then
+12 -9
View File
@@ -1,5 +1,6 @@
local resourceName = "qb-input"
if GetResourceState('qb-input') ~= 'started' or (BridgeClientConfig.InputSystem ~= "qb" and BridgeClientConfig.InputSystem ~= "auto") then return end local configValue = BridgeClientConfig.InputSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
function OxTypeToQBType(_type) function OxTypeToQBType(_type)
if _type == "input" then if _type == "input" then
@@ -39,14 +40,16 @@ function OxToQBInput(data)
} }
if v.type == "select" then if v.type == "select" then
input.text = "" input.text = ""
input.options = { input.options = {}
{value = v.value, text = v.label} for k, j in pairs(v.options) do
} table.insert(input.options, {value = j.value, text = j.label})
end
elseif v.type == "checkbox" then elseif v.type == "checkbox" then
input.text = "" input.text = ""
input.options = { input.options = {}
{value = v.value, text = v.label} for k, j in pairs(v.options) do
} table.insert(input.options, {value = j.value, text = j.label})
end
end end
table.insert(returnData, input) table.insert(returnData, input)
end end
@@ -67,7 +70,7 @@ function OpenInput(title, data, isQBFormat, submitText)
if returnData[1] then return returnData end if returnData[1] then return returnData end
--converting to standard format (ox) --converting to standard format (ox)
local convertedData = {} local convertedData = {}
if isQBFormat then if isQBFormat then
for i, v in pairs(input) do for i, v in pairs(input) do
for k, j in pairs(returnData) do for k, j in pairs(returnData) do
if k == v.text then if k == v.text then
+13 -3
View File
@@ -1,26 +1,36 @@
Inventory = Inventory or {} Inventory = Inventory or {}
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param item string ---@param item string
---@return table ---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
return Framework.GetItemInfo(item) return Framework.GetItemInfo(item)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param item string ---@param item string
---@return boolean ---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return Framework.HasItem(item) return Framework.HasItem(item)
end end
---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param item string
---@return number
Inventory.GetItemCount = function(item) Inventory.GetItemCount = function(item)
return Framework.GetItemCount(item) return Framework.GetItemCount(item)
end end
---comment ---This will provide a image of the community bridge logo if the inventory isnt bridged for the specific path.
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.StripPNG = function(item)
if string.find(item, ".png") then
item = string.gsub(item, ".png", "")
end
return item
end
+21 -14
View File
@@ -1,36 +1,36 @@
Inventory = Inventory or {} Inventory = Inventory or {}
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param item string ---@param item string
---@param count number ---@param count number
---@param slot number ---@param slot number
---@param metadata table ---@param metadata table
---@return boolean ---@return boolean|nil
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
return Framework.AddItem(src, item, count, slot, metadata) return Framework.AddItem(src, item, count, slot, metadata)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param item string ---@param item string
---@param count number ---@param count number
---@param slot number ---@param slot number
---@param metadata table ---@param metadata table
---@return boolean ---@return boolean|nil
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
item = type(item) == "table" and item.name or item item = type(item) == "table" and item.name or item
return Framework.RemoveItem(src, item, count, slot, metadata) return Framework.RemoveItem(src, item, count, slot, metadata)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param item string ---@param item string
---@return boolean ---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
return false, print("This Inventory Has Not Been Bridged For An Item Info Feature.") return Framework.GetItemInfo(item)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param item string ---@param item string
---@param metadata table ---@param metadata table
@@ -39,14 +39,14 @@ Inventory.GetItemCount = function(src, item, metadata)
return Framework.GetItemCount(src, item, metadata) return Framework.GetItemCount(src, item, metadata)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@return table ---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
return Framework.GetPlayerInventory(src) return Framework.GetPlayerInventory(src)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param slot number ---@param slot number
---@return table ---@return table
@@ -54,7 +54,7 @@ Inventory.GetItemBySlot = function(src, slot)
return Framework.GetItemBySlot(src, slot) return Framework.GetItemBySlot(src, slot)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param item string ---@param item string
---@param slot number ---@param slot number
@@ -64,7 +64,7 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
return Framework.SetMetadata(src, item, slot, metadata) return Framework.SetMetadata(src, item, slot, metadata)
end end
---comment ---This will fallback to framework add item functions when an inventory does not have the specifiec function.
---@param src number ---@param src number
---@param id string||number ---@param id string||number
---@param label string ---@param label string
@@ -75,12 +75,19 @@ end
---@param coords table ---@param coords table
---@return boolean ---@return boolean
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
return false, print("This Inventory Has Not Been Bridged For A Stash Feature.") return false, Prints.Error("This Inventory Has Not Been Bridged For A Stash Feature.")
end end
---comment ---This will provide a image of the community bridge logo if the inventory isnt bridged for the specific path.
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.StripPNG = function(item)
if string.find(item, ".png") then
item = string.gsub(item, ".png", "")
end
return item
end
+3 -1
View File
@@ -8,13 +8,14 @@ local codem = exports['codem-inventory']
---@return table ---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = codem:GetItemList(item) local itemData = codem:GetItemList(item)
local image = itemData.image and Inventory.GetImagePath(itemData.image) or Inventory.GetImagePath(item)
local repackedTable = { local repackedTable = {
name = itemData.name or "Missing Name", name = itemData.name or "Missing Name",
label = itemData.label or "Missing Label", label = itemData.label or "Missing Label",
stack = itemData.unique or "false", stack = itemData.unique or "false",
weight = itemData.weight or "0", weight = itemData.weight or "0",
description = itemData.description or "none", description = itemData.description or "none",
image = itemData.image or Inventory.GetImagePath(item), image = image,
} }
return repackedTable or {} return repackedTable or {}
end end
@@ -43,6 +44,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -86,6 +86,7 @@ Inventory.GetItemBySlot = function(src, slot)
end end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("codem-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://codem-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -10,7 +10,24 @@ Inventory = Inventory or {}
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item)) local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item) local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end
Inventory.GetItemInfo = function(item)
local frameworkName = Framework.GetFrameworkName()
if not frameworkName then return {} end
local dataRepack = {}
if frameworkName == 'es_extended' then
local callbackData = lib.callback.await('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
elseif frameworkName == 'qb-core' then
dataRepack = Framework.Shared.Items[item]
if not dataRepack then return {} end
end
return {name = dataRepack.name, label = dataRepack.label, stack = dataRepack.stack, weight = dataRepack.weight, description = dataRepack.description, image = Inventory.GetImagePath(dataRepack.name) }
end end
+7 -1
View File
@@ -8,6 +8,7 @@ local core = exports.core_inventory
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item)) local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item) local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -34,4 +35,9 @@ Inventory.UpdatePlate = function(oldplate, newplate)
if GetResourceState('jg-mechanic') ~= 'started' then return true end if GetResourceState('jg-mechanic') ~= 'started' then return true end
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
return true return true
end end
lib.callback.register('community_bridge:Callback:core_inventory', function(source)
local items = core:getItemsList()
return items or {}
end)
@@ -20,7 +20,22 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetItemInfo = function(item)
local itemData = Framework.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = Inventory.GetImagePath(itemData.name)
}
return repackedTable
end
@@ -43,6 +43,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -43,6 +43,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -104,6 +104,7 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
end end
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("origen_inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://origen_inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -40,6 +40,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item)) local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item))
local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item) local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
+19
View File
@@ -16,6 +16,24 @@ Inventory.AddItem = function(src, item, count, slot, metadata)
return ox_inventory:AddItem(src, item, count, metadata) return ox_inventory:AddItem(src, item, count, metadata)
end end
Inventory.GetItemInfo = function(item)
local itemData = ox_inventory:Items(item)
if not itemData then return {} end
local repackedTable = {
name = itemData.name or "Missing Name",
label = itemData.label or "Missing Label",
stack = itemData.stack or "true",
weight = itemData.weight or "0",
description = itemData.description or "none",
image = string.format("nui://ox_inventory/web/images/%s", itemData.client
and itemData.client.image
or string.format("%s.png", item)
),
}
return repackedTable
end
-- string.format("nui://ox_inventory/web/images/%s.png", item)
---This will remove an item, and return true or false based on success ---This will remove an item, and return true or false based on success
---@param src number ---@param src number
---@param item string ---@param item string
@@ -148,6 +166,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item)) local file = LoadResourceFile("ox_inventory", string.format("web/images/%s.png", item))
local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item) local imagePath = file and string.format("nui://ox_inventory/web/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
+15
View File
@@ -22,7 +22,22 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetItemInfo = function(item)
local itemData = Framework.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = Inventory.GetImagePath(itemData.name)
}
return repackedTable
end
+3 -4
View File
@@ -36,6 +36,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -67,12 +68,11 @@ end
---@param metadata table ---@param metadata table
---@return boolean ---@return boolean
Inventory.AddItem = function(src, item, amount, slot, metadata) Inventory.AddItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add') TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', amount)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return sloth:AddItem(src, item, amount, slot, metadata, 'community_bridge') return sloth:AddItem(src, item, amount, slot, metadata, 'community_bridge')
end end
---comment ---comment
---@param src number ---@param src number
---@param item string ---@param item string
@@ -81,12 +81,11 @@ end
---@param metadata table ---@param metadata table
---@return boolean ---@return boolean
Inventory.RemoveItem = function(src, item, amount, slot, metadata) Inventory.RemoveItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove') TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove', amount)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return sloth:RemoveItem(src, item, amount, slot, 'community_bridge') return sloth:RemoveItem(src, item, amount, slot, 'community_bridge')
end end
---comment ---comment
---@param oldplate string ---@param oldplate string
---@param newplate string ---@param newplate string
+16
View File
@@ -21,7 +21,23 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
Inventory.GetItemInfo = function(item)
local itemData = Framework.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = Inventory.GetImagePath(itemData.image or itemData.name)
}
return repackedTable
end
+18 -3
View File
@@ -40,10 +40,26 @@ Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coo
end end
Inventory.GetItemInfo = function(item)
local itemData = Framework.Shared.Items[item]
if not itemData then return {} end
local repackedTable = {
name = itemData.name,
label = itemData.label,
stack = itemData.unique,
weight = itemData.weight,
description = itemData.description,
image = Inventory.GetImagePath(itemData.image or itemData.name)
}
return repackedTable
end
---comment ---comment
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
-- check if contains.png and remove it if it does
item = Inventory.StripPNG(item)
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -76,7 +92,6 @@ Inventory.GetItemBySlot = function(src, slot)
} }
end end
---comment ---comment
---@param oldplate string ---@param oldplate string
---@param newplate string ---@param newplate string
@@ -109,13 +124,13 @@ Inventory.UpdatePlate = function(oldplate, newplate)
end end
Inventory.AddItem = function(src, item, amount, slot, metadata) Inventory.AddItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add') TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add', amount)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return exports['qb-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge') return exports['qb-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge')
end end
Inventory.RemoveItem = function(src, item, amount, slot, metadata) Inventory.RemoveItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove') TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove', amount)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge') return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
end end
@@ -39,6 +39,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -153,6 +153,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("qs-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qs-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
@@ -44,6 +44,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item))
local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
@@ -135,6 +135,7 @@ end
---@param item string ---@param item string
---@return string ---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
item = Inventory.StripPNG(item)
local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item)) local pngPath = LoadResourceFile("inventory_images", string.format("html/images/%s.png", item))
local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item)) local webpPath = LoadResourceFile("inventory_images", string.format("html/images/%s.webp", item))
local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item) local imagePath = pngPath and string.format("nui://inventory_images/html/images/%s.png", item) or webpPath and string.format("nui://inventory_images/html/images/%s.webp", item)
+10 -5
View File
@@ -22,7 +22,8 @@ local function convertFromOx(options)
}, },
animation = { animation = {
animDict = options.anim?.dict, animDict = options.anim?.dict,
anim = options.anim?.clip anim = options.anim?.clip,
flags = 49
}, },
prop = { prop = {
model = prop1.model, model = prop1.model,
@@ -43,15 +44,19 @@ end
---@param options table ---@param options table
---@param cb any ---@param cb any
---@param qbFormat boolean ---@param qbFormat boolean
---@return nil ---@return success boolean
function ProgressBar.Open(options, cb, qbFormat) function ProgressBar.Open(options, cb, qbFormat)
if not exports['progressbar'] then return false end if not exports['progressbar'] then return false end
if not qbFormat then if not qbFormat then
options = convertFromOx(options) options = convertFromOx(options)
end end
local prom = promise.new()
exports['progressbar']:Progress(options, cb) exports['progressbar']:Progress(options, function(cancelled)
if cb then cb(not cancelled) end
prom:resolve(not cancelled)
end)
return Citizen.Await(prom)
end end
@@ -78,4 +83,4 @@ RegisterCommand("progressbar", function()
print(cancelled and "Cancelled" or "Complete") print(cancelled and "Cancelled" or "Complete")
end) end)
end) end)
--]] --]]
+3 -3
View File
@@ -24,7 +24,7 @@ Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
{ {
title = locale('Shops.PayByCard').." "..tostring(mathStuff), title = locale('Shops.PayByCard').." "..tostring(mathStuff),
description = locale('Shops.AreYouSure') .. itemLabel, description = locale('Shops.AreYouSure') .. itemLabel,
icon = "fa-solid fa-building-column", icon = "fa-solid fa-building-columns",
onSelect = function(_, __, ___) onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "bank") TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "bank")
end end
@@ -59,7 +59,7 @@ end
---@param shopData any ---@param shopData any
---@return nil ---@return nil
Shops.OpenShop = function(title, shopData) Shops.OpenShop = function(title, shopData)
if not title and not shopData and not title then return print("No Title Passed") end if not title and not shopData and not title then return Prints.Error("No Title Passed") end
local generatedID = Ids.CreateUniqueId() local generatedID = Ids.CreateUniqueId()
local buildMenu = {} local buildMenu = {}
for _, v in pairs(shopData) do for _, v in pairs(shopData) do
@@ -75,4 +75,4 @@ Shops.OpenShop = function(title, shopData)
}) })
end end
Menu.Open({ id = generatedID, title = title, options = buildMenu }, false) Menu.Open({ id = generatedID, title = title, options = buildMenu }, false)
end end
+1 -1
View File
@@ -44,7 +44,7 @@ Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
break break
end end
end end
if not itemData then return print("Player ID "..src.." Is Possibly A Cheater And Has Attempted To Purchase A "..item) end if not itemData then return Prints.Error("Player ID "..src.." Is Possibly A Cheater And Has Attempted To Purchase A "..item) end
if not itemData.price then return end if not itemData.price then return end
local balance = Framework.GetAccountBalance(src, paymentType) local balance = Framework.GetAccountBalance(src, paymentType)
local mathStuff = tonumber(itemData.price) * tonumber(amount) local mathStuff = tonumber(itemData.price) * tonumber(amount)
@@ -4,7 +4,7 @@ VehicleKey = VehicleKey or {}
---@param vehicle number The vehicle entity ID. ---@param vehicle number The vehicle entity ID.
---@param plate string The plate of the vehicle. ---@param plate string The plate of the vehicle.
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
return true, print("There Is No Vehicle Key System Installed") return true, Prints.Error("There Is No Vehicle Key System Installed")
end end
---This will remove keys from the specifed vehicle/plate. ---This will remove keys from the specifed vehicle/plate.
@@ -12,5 +12,5 @@ end
---@param plate string The plate of the vehicle. ---@param plate string The plate of the vehicle.
---@return boolean | nil ---@return boolean | nil
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
return true, print("There Is No Vehicle Key System Installed") return true, Prints.Error("There Is No Vehicle Key System Installed")
end end
+5 -11
View File
@@ -1,11 +1,7 @@
Version = Version or {} Version = Version or {}
---Pass a github username and repo name to check for the latest version of the resource. ---Pass a github username and repo name to check for the latest version of the resource.
---
---
---Tebex is a optional boolean to determine if the message should be for a escrowed resource or not. ---Tebex is a optional boolean to determine if the message should be for a escrowed resource or not.
---
---
---Example Version.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge") ---Example Version.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge")
---@param repoPath string ---@param repoPath string
---@param tebex boolean | nil ---@param tebex boolean | nil
@@ -23,22 +19,20 @@ function Version.VersionChecker(repoPath, tebex)
local username, reponame = repoPath:match("([^/]+)/([^/]+)") local username, reponame = repoPath:match("([^/]+)/([^/]+)")
if not username or not reponame then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end if not username or not reponame then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end
PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response) PerformHttpRequest(('https://api.github.com/repos/%s/%s/releases/latest'):format(username, reponame), function(status, response)
local failure = ('^1Unable locate github repo for resource %s ^0'):format(resource)
if status ~= 200 then return Prints.Error(failure) end if status ~= 200 then return end
response = json.decode(response) response = json.decode(response)
if response.prerelease then return Prints.Error(failure) end
local latest = response.tag_name:match('%d+%.%d+%.%d+') local latest = response.tag_name:match('%d+%.%d+%.%d+')
if not latest then return Prints.Error(failure) end if not latest then return end
--if latest == version then return print(('^2 %s is on the latest version.^0'):format(resource)) end
if latest == version then return end if latest == version then return end
local currentVersion, latestVersion = version:gsub('%D', ''), latest:gsub('%D', '') local currentVersion, latestVersion = version:gsub('%D', ''), latest:gsub('%D', '')
if currentVersion < latestVersion then if currentVersion < latestVersion then
if tebex then return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the portal/keymaster.^7\r\n%s'):format(resource, version, "https://portal.cfx.re/assets/granted-assets")) end if tebex then
return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the portal/keymaster.^7\r\n%s'):format(resource, version, "https://portal.cfx.re/assets/granted-assets"))
end
return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the GitHub release page.^7\r\n%s'):format(resource, version, response.html_url)) return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the GitHub release page.^7\r\n%s'):format(resource, version, response.html_url))
end end
end, 'GET') end, 'GET')
+7
View File
@@ -0,0 +1,7 @@
RegisterCommand("test_particle", function(source, args, rawCommand)
local playerPed = PlayerPedId()
local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 1.0, 0.0)
local heading = GetEntityHeading(playerPed)
Particle.Create("core", "ent_dst_concrete_large", coords, vector3(0.0, 0.0, heading), 1.0, vector3(1.0, 1.0, 1.0), false)
end)