Merge branch 'The-Order-Of-The-Sacred-Framework:dev' into dev
This commit is contained in:
61 files changed
+625
-139
No files matched your search
+3
-1
@@ -4,7 +4,7 @@ lua54 'yes'
|
|||||||
use_experimental_fxv2_oal 'yes'
|
use_experimental_fxv2_oal 'yes'
|
||||||
author 'The Order of the Sacred Framework'
|
author 'The Order of the Sacred Framework'
|
||||||
description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.'
|
description 'A bridge made for the community to use as a base for their own projects. This bridge will allow a single format to work with nearly all commonly used systems while still offering expandability.'
|
||||||
version '0.5.0'
|
version '0.5.1'
|
||||||
|
|
||||||
shared_scripts {
|
shared_scripts {
|
||||||
'@ox_lib/init.lua',
|
'@ox_lib/init.lua',
|
||||||
@@ -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',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,22 +1,20 @@
|
|||||||
Particle = {}
|
Particle = {}
|
||||||
Particles = {}
|
|
||||||
|
|
||||||
|
---Loads a ptfx asset into memory.
|
||||||
--- Load a particle dictionary. This function will block until the dictionary is loaded.
|
---@param dict string
|
||||||
--- @param dict string -- The name of the particle dictionary to load.
|
---@return boolean
|
||||||
--- @return boolean -- Returns true if the dictionary was loaded successfully, false otherwise.
|
function LoadPtfxAsset(dict)
|
||||||
--- @throws string -- Throws an error if the dictionary fails to load after 100 attempts.
|
|
||||||
function Particle.LoadDict(dict)
|
|
||||||
RequestNamedPtfxAsset(dict)
|
|
||||||
local failed = 100
|
local failed = 100
|
||||||
while not HasNamedPtfxAssetLoaded(dict) and failed >= 0 do
|
while not HasNamedPtfxAssetLoaded(dict) and failed >= 0 do
|
||||||
|
RequestNamedPtfxAsset(dict)
|
||||||
failed = failed - 1
|
failed = failed - 1
|
||||||
Wait(50)
|
Wait(100)
|
||||||
end
|
end
|
||||||
assert(failed >= 0, "Failed to load particle dictionary: " .. dict)
|
assert(failed > 0, "Failed to load dict asset: " .. dict)
|
||||||
return true
|
return HasNamedPtfxAssetLoaded(dict)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Create a particle effect at the specified position and rotation.
|
--- Create a particle effect at the specified position and rotation.
|
||||||
--- @param dict string
|
--- @param dict string
|
||||||
--- @param ptfx string
|
--- @param ptfx string
|
||||||
@@ -28,26 +26,57 @@ end
|
|||||||
--- @param loopLength number|nil
|
--- @param loopLength number|nil
|
||||||
--- @return number|nil ptfxHandle -- The handle of the particle effect, or nil if it failed to create.
|
--- @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)
|
function Particle.Create(dict, ptfx, pos, rot, scale, color, looped, loopLength)
|
||||||
if not Particle.LoadDict(dict) then return end
|
LoadPtfxAsset(dict)
|
||||||
UseParticleFxAssetNextCall(dict)
|
CreateThread(function()
|
||||||
local handle = nil
|
UseParticleFxAssetNextCall(dict)
|
||||||
if looped then
|
|
||||||
handle = StartParticleFxLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false)
|
|
||||||
SetParticleFxLoopedColour(handle, color.x, color.y, color.z, false)
|
|
||||||
if loopLength then
|
|
||||||
Wait(loopLength)
|
|
||||||
StopParticleFxLooped(handle, 0)
|
|
||||||
RemoveParticleFx(handle, false)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
SetParticleFxNonLoopedColour(color.x, color.y, color.z)
|
SetParticleFxNonLoopedColour(color.x, color.y, color.z)
|
||||||
handle = StartParticleFxNonLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false)
|
if looped then
|
||||||
RemoveParticleFx(handle, false)
|
StartParticleFxLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false)
|
||||||
end
|
if loopLength then
|
||||||
return handle
|
Wait(loopLength)
|
||||||
|
RemoveParticleFxInRange(pos.x, pos.y, pos.z, 0.01)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
StartParticleFxNonLoopedAtCoord(ptfx, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z, scale, false, false, false, false)
|
||||||
|
end
|
||||||
|
RemoveNamedPtfxAsset(ptfx)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- need to add looping effects (regarless of if its a looped particle or not)
|
function Particle.CreateOnEntity(dict, ptfx, entity, offset, rot, scale, color, looped, loopLength)
|
||||||
|
LoadPtfxAsset(dict)
|
||||||
|
UseParticleFxAssetNextCall(dict)
|
||||||
|
SetParticleFxNonLoopedColour(color.x, color.y, color.z)
|
||||||
|
local particle = nil
|
||||||
|
if looped then
|
||||||
|
particle = StartNetworkedParticleFxLoopedOnEntity(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale, false, false, false)
|
||||||
|
if loopLength then
|
||||||
|
Wait(loopLength)
|
||||||
|
RemoveParticleFxFromEntity(entity)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
particle = StartNetworkedParticleFxLoopedOnEntity(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, scale, false, false, false)
|
||||||
|
end
|
||||||
|
RemoveNamedPtfxAsset(ptfx)
|
||||||
|
return particle
|
||||||
|
end
|
||||||
|
|
||||||
|
function Particle.CreateOnEntityBone(dict, ptfx, entity, bone, offset, rot, scale, color, looped, loopLength)
|
||||||
|
LoadPtfxAsset(dict)
|
||||||
|
UseParticleFxAssetNextCall(dict)
|
||||||
|
SetParticleFxNonLoopedColour(color.x, color.y, color.z)
|
||||||
|
local particle = nil
|
||||||
|
if looped then
|
||||||
|
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
|
||||||
|
particle = StartNetworkedParticleFxNonLoopedOnEntityBone(ptfx, entity, offset.x, offset.y, offset.z, rot.x, rot.y, rot.z, bone, scale, false, false, false)
|
||||||
|
end
|
||||||
|
RemoveNamedPtfxAsset(ptfx)
|
||||||
|
return particle
|
||||||
|
end
|
||||||
|
|
||||||
return Particle
|
return Particle
|
||||||
@@ -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
|
||||||
@@ -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,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
|
||||||
|
|||||||
@@ -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,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()
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -171,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)
|
||||||
@@ -202,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,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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -221,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
|
||||||
|
|
||||||
@@ -234,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
|
||||||
@@ -307,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
|
||||||
@@ -318,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
|
||||||
@@ -401,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
|
||||||
@@ -449,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,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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -40,8 +49,9 @@ Framework.GetPlayers = function()
|
|||||||
return playerList
|
return playerList
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Framework.GetPlayerName(src)
|
---Returns the first and last name of the player.
|
||||||
-- 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
|
||||||
@@ -49,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
|
||||||
@@ -70,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
|
||||||
@@ -85,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
|
||||||
@@ -94,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
|
||||||
@@ -113,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
|
||||||
@@ -122,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
|
||||||
@@ -131,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
|
||||||
@@ -143,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
|
||||||
@@ -155,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
|
||||||
@@ -167,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
|
||||||
@@ -179,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
|
||||||
@@ -187,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
|
||||||
@@ -195,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
|
||||||
@@ -204,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()
|
||||||
@@ -222,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
|
||||||
@@ -253,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
|
||||||
@@ -262,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
|
||||||
@@ -272,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
|
||||||
@@ -281,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
|
||||||
@@ -290,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
|
||||||
@@ -300,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 .. "'")
|
||||||
@@ -312,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)
|
||||||
@@ -325,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
|
|
||||||
@@ -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.
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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)
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Housing = Housing or {}
|
||||||
@@ -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)
|
||||||
@@ -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)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
if GetResourceState('bcs-housing') ~= 'started' then return end
|
||||||
|
|
||||||
|
Housing = Housing or {}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
if GetResourceState('esx_property') ~= 'started' then return end
|
||||||
|
|
||||||
|
Housing = Housing or {}
|
||||||
@@ -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)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
if GetResourceState('ps-housing') ~= 'started' then return end
|
||||||
|
|
||||||
|
Housing = Housing or {}
|
||||||
@@ -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)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
if GetResourceState('qb-houses') ~= 'started' then return end
|
||||||
|
|
||||||
|
Housing = Housing or {}
|
||||||
@@ -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)
|
||||||
@@ -26,4 +26,11 @@ end
|
|||||||
---@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
|
||||||
|
|
||||||
|
Inventory.StripPNG = function(item)
|
||||||
|
if string.find(item, ".png") then
|
||||||
|
item = string.gsub(item, ".png", "")
|
||||||
|
end
|
||||||
|
return item
|
||||||
end
|
end
|
||||||
@@ -83,4 +83,11 @@ end
|
|||||||
---@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
|
||||||
|
|
||||||
|
Inventory.StripPNG = function(item)
|
||||||
|
if string.find(item, ".png") then
|
||||||
|
item = string.gsub(item, ".png", "")
|
||||||
|
end
|
||||||
|
return item
|
||||||
end
|
end
|
||||||
@@ -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,6 +10,7 @@ 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"
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -20,6 +20,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("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"
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -22,6 +22,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"
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -21,6 +21,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("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"
|
||||||
@@ -35,7 +36,7 @@ Inventory.GetItemInfo = function(item)
|
|||||||
stack = itemData.unique,
|
stack = itemData.unique,
|
||||||
weight = itemData.weight,
|
weight = itemData.weight,
|
||||||
description = itemData.description,
|
description = itemData.description,
|
||||||
image = Inventory.GetImagePath(itemData.name)
|
image = Inventory.GetImagePath(itemData.image or itemData.name)
|
||||||
}
|
}
|
||||||
return repackedTable
|
return repackedTable
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -44,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
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user