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

Dev sync 0.4.0
This commit is contained in:
MrNewb authored and GitHub committed 2025-03-09 23:43:08 -04:00
commit 7f5da592e5
100 files changed
+1328 -456

No files matched your search

+3 -3
View File
@@ -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.3.13' version '0.4.0'
shared_scripts { shared_scripts {
'@ox_lib/init.lua', '@ox_lib/init.lua',
@@ -26,8 +26,7 @@ server_scripts {
'modules/managment/**/server.lua', 'modules/managment/**/server.lua',
'modules/dispatch/**/server.lua', 'modules/dispatch/**/server.lua',
'modules/clothing/**/server.lua', 'modules/clothing/**/server.lua',
'modules/weather/**/server.lua', 'modules/shops/**/server.lua',
'modules/vehicleKey/**/server.lua',
'modules/notify/**/server.lua', 'modules/notify/**/server.lua',
'init.lua', 'init.lua',
} }
@@ -50,6 +49,7 @@ client_scripts {
'modules/menu/*.lua', 'modules/menu/*.lua',
'modules/notify/**/client.lua', 'modules/notify/**/client.lua',
'modules/dialogue/**/client/*.lua', 'modules/dialogue/**/client/*.lua',
'modules/shops/**/client.lua',
'init.lua', 'init.lua',
} }
+4 -2
View File
@@ -52,8 +52,8 @@ Bridge.RegisterModule("Language", Language)
Bridge.RegisterModule("Doorlock", Doorlock) Bridge.RegisterModule("Doorlock", Doorlock)
Bridge.RegisterModule("Phone", Phone) Bridge.RegisterModule("Phone", Phone)
Bridge.RegisterModule("Dispatch", Dispatch) Bridge.RegisterModule("Dispatch", Dispatch)
Bridge.RegisterModule("VehicleKey", VehicleKey) Bridge.RegisterModule("Shops", Shops)
Bridge.RegisterModule("Weather", Weather)
--lib --lib
Bridge.RegisterModule("Tables", cLib.Tables) Bridge.RegisterModule("Tables", cLib.Tables)
Bridge.RegisterModule("Math", cLib.Math) Bridge.RegisterModule("Math", cLib.Math)
@@ -92,6 +92,8 @@ if IsDuplicityVersion() then return end
Bridge.RegisterModule("Fuel", Fuel) Bridge.RegisterModule("Fuel", Fuel)
Bridge.RegisterModule("Input", Input) Bridge.RegisterModule("Input", Input)
Bridge.RegisterModule("ProgressBar", ProgressBar) Bridge.RegisterModule("ProgressBar", ProgressBar)
Bridge.RegisterModule("VehicleKey", VehicleKey)
Bridge.RegisterModule("Weather", Weather)
Bridge.RegisterModule("Target", Target) Bridge.RegisterModule("Target", Target)
Bridge.RegisterModule("Menu", Menu) Bridge.RegisterModule("Menu", Menu)
+47 -43
View File
@@ -4,7 +4,6 @@ local spawnedPeds = {}
local ActivePoints = {} local ActivePoints = {}
Utility.CreateProp = function(model, coords, heading, networked) Utility.CreateProp = function(model, coords, heading, networked)
if networked == nil then networked = true end
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end
local propEntity = CreateObject(model, coords.x, coords.y, coords.z, networked, false, false) local propEntity = CreateObject(model, coords.x, coords.y, coords.z, networked, false, false)
@@ -14,30 +13,20 @@ Utility.CreateProp = function(model, coords, heading, networked)
end end
Utility.CreateVehicle = function(model, coords, heading, networked) Utility.CreateVehicle = function(model, coords, heading, networked)
if networked == nil then networked = true end
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end
local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, networked, false) local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, networked, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true) SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetVehicleNeedsToBeHotwired(vehicle, false) SetVehicleNeedsToBeHotwired(vehicle, false)
SetModelAsNoLongerNeeded(model)
SetVehRadioStation(vehicle, "OFF") SetVehRadioStation(vehicle, "OFF")
SetModelAsNoLongerNeeded(model)
return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), } return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), }
end end
Utility.CreatePed = function(model, coords, heading, networked, clothing) Utility.CreatePed = function(model, coords, heading, networked, settings)
if networked == nil then networked = true end
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end
local spawnedEntity = CreatePed(0, model, coords.x, coords.y, coords.z, heading, networked, false) local spawnedEntity = CreatePed(0, model, coords.x, coords.y, coords.z, heading, networked, false)
if clothing then
for componentID, v in pairs(clothing) do
SetPedComponentVariation(spawnedEntity, componentID, v[1], v[2], 0)
end
end
FreezeEntityPosition(spawnedEntity, true)
SetEntityInvincible(spawnedEntity, true)
SetBlockingOfNonTemporaryEvents(spawnedEntity, true)
SetModelAsNoLongerNeeded(model) SetModelAsNoLongerNeeded(model)
table.insert(spawnedPeds, spawnedEntity) table.insert(spawnedPeds, spawnedEntity)
return spawnedEntity return spawnedEntity
@@ -48,17 +37,23 @@ Utility.StartBusySpinner = function(text)
BeginTextCommandBusyString(text) BeginTextCommandBusyString(text)
AddTextComponentSubstringPlayerName(text) AddTextComponentSubstringPlayerName(text)
EndTextCommandBusyString(0) EndTextCommandBusyString(0)
return true
end end
Utility.StopBusySpinner = function() Utility.StopBusySpinner = function()
if BusyspinnerIsOn() then BusyspinnerOff() end if BusyspinnerIsOn() then
BusyspinnerOff()
return true
end
return false
end end
Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange) Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange, displayType)
local blip = AddBlipForCoord(coords.x, coords.y, coords.z) local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, sprite or 8) SetBlipSprite(blip, sprite or 8)
SetBlipColour(blip, color or 3) SetBlipColour(blip, color or 3)
SetBlipScale(blip, scale or 0.8) SetBlipScale(blip, scale or 0.8)
SetBlipDisplay(blip, displayType or 2)
SetBlipAsShortRange(blip, shortRange) SetBlipAsShortRange(blip, shortRange)
AddTextEntry(label, label) AddTextEntry(label, label)
BeginTextCommandSetBlipName(label) BeginTextCommandSetBlipName(label)
@@ -71,7 +66,7 @@ Utility.RemoveBlip = function(blip)
local success = false local success = false
for i, storedBlip in ipairs(blipIDs) do for i, storedBlip in ipairs(blipIDs) do
if storedBlip == blip then if storedBlip == blip then
RemoveBlip(blip) RemoveBlip(storedBlip)
table.remove(blipIDs, i) table.remove(blipIDs, i)
success = true success = true
break break
@@ -104,7 +99,9 @@ end
Utility.RemovePed = function(entity) Utility.RemovePed = function(entity)
local success = false local success = false
DeleteEntity(entity) if DoesEntityExist(entity) then
DeleteEntity(entity)
end
for i, storedEntity in ipairs(spawnedPeds) do for i, storedEntity in ipairs(spawnedPeds) do
if storedEntity == entity then if storedEntity == entity then
table.remove(spawnedPeds, i) table.remove(spawnedPeds, i)
@@ -230,51 +227,58 @@ Utility.GetClosestPlayer = function(coords, distanceScope, includeMe)
return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer) return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer)
end end
-- register points ---This function is used to register a point on the map, functions are fired when in the distance/exiting the area
Utility.RegisterPoint = function(pointCoords, pointDistance, pointOnEnter, pointOnExit) ---@param pointID string
local enterZone = lib.points.new({ ---@param pointCoords table
coords = pointCoords, ---@param pointDistance number
---@param _onEnter function
---@param _onExit function
---@param _nearby function
Utility.RegisterPoint = function(pointID, pointCoords, pointDistance, _onEnter, _onExit, _nearby)
ActivePoints[pointID] = lib.points.new({
coords = pointCoords,
distance = pointDistance, distance = pointDistance,
onEnter = function(self) onEnter = function(self)
pointOnEnter(self) _onEnter(self)
end, end,
onExit = function(self) onExit = function(self)
pointOnExit(self) _onExit(self)
end, end,
nearby = function(self)
_nearby(self)
end
}) })
local pointID = Bridge.Ids.RandomLower(nil, 8)
ActivePoints[pointID] = enterZone
return enterZone, pointID
end end
-- Function to retrieve the enterZone using pointID -- Function to retrieve the zone by the pointID
---@param pointID string
Utility.GetPointById = function(pointID) Utility.GetPointById = function(pointID)
return ActivePoints[pointID] return ActivePoints[pointID]
end end
---@return table | nil
Utility.GetActivePoints = function()
return ActivePoints
end
---Pass the point ID to remove the point from the map
---@param pointID string
---@return boolean
Utility.RemovePoint = function(pointID) Utility.RemovePoint = function(pointID)
local point = ActivePoints[pointID] if not ActivePoints[pointID] then return false end
if point then ActivePoints[pointID]:remove()
--print("Removing point with ID " .. pointID) ActivePoints[pointID] = nil
point:remove() -- Call the remove method on the point (ensure this method stops all event listeners) return true
ActivePoints[pointID] = nil -- Remove from ActivePoints table
--print("Point removed successfully.")
return true
else
--print("Point with ID " .. pointID .. " not found.")
return false
end
end end
AddEventHandler('onResourceStop', function(resource) AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then if resource == GetCurrentResourceName() then
for _, blip in pairs(blipIDs) do for _, blip in pairs(blipIDs) do
if DoesBlipExist(blip.id) then if blip and DoesBlipExist(blip) then
RemoveBlip(blip.id) RemoveBlip(blip)
end end
end end
for _, ped in pairs(spawnedPeds) do for _, ped in pairs(spawnedPeds) do
if DoesEntityExist(ped) then if ped and DoesEntityExist(ped) then
DeleteEntity(ped) DeleteEntity(ped)
end end
end end
+1 -7
View File
@@ -106,13 +106,7 @@ function Callback.Trigger(name, func, ...)
local p = promise.new() local p = promise.new()
TriggerServerEvent(clientToServerName, name, ...) TriggerServerEvent(clientToServerName, name, ...)
cbData[name] = {cb = func, p = p} cbData[name] = {cb = func, p = p}
CreateThread(function()
Wait(5000)
if cbData[name] then
cbData[name].p:resolve()
cbData[name] = nil
end
end)
return Citizen.Await(p) return Citizen.Await(p)
end end
+1
View File
@@ -6,6 +6,7 @@
"place_object_scroll_down": "[SCROLL DOWN] Turn left", "place_object_scroll_down": "[SCROLL DOWN] Turn left",
"enter_text": "Enter Text", "enter_text": "Enter Text",
"no_prop_defined": "You didnt define any object to place", "no_prop_defined": "You didnt define any object to place",
"Shops": {"NotEnoughMoney": "You dont have enough money to buy this item", "Input":"Amount Input", "PurchaseAmount":"Purchase Quanity","PurchasedItem": "You Have Purchased ", "CurrencySymbol": "$", "Confirm":"Confirm Purchase","AreYouSure":"Are you sure you want to purchase a ", "PayByCash": "Pay by cash", "PayByCard": "Pay by card" },
"UNITTEST": { "UNITTEST": {
"UNITTESTA": "Im a %s %s", "UNITTESTA": "Im a %s %s",
"UNITTEST": { "UNITTEST": {
+26
View File
@@ -8,10 +8,14 @@ Framework.GetFrameworkName = function()
return 'es_extended' return 'es_extended'
end end
---comment
---@return table
Framework.GetPlayerData = function() Framework.GetPlayerData = function()
return ESX.PlayerData return ESX.PlayerData
end end
---comment
---@return string
Framework.GetPlayerDob = function() Framework.GetPlayerDob = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
local dob = playerData.dateofbirth local dob = playerData.dateofbirth
@@ -22,35 +26,57 @@ Framework.GetPlayerMetaData = function(metadata)
return ESX.GetPlayerData().metadata[metadata] return ESX.GetPlayerData().metadata[metadata]
end end
---comment
---@param message string
---@param type string
---@param time number
---@return nil
Framework.Notify = function(message, type, time) Framework.Notify = function(message, type, time)
return ESX.ShowNotification(message, type, time) return ESX.ShowNotification(message, type, time)
end end
---comment
---@return string
Framework.GetPlayerIdentifier = function() Framework.GetPlayerIdentifier = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
return playerData.identifier return playerData.identifier
end end
---comment
---@return string
---@return string
Framework.GetPlayerName = function() Framework.GetPlayerName = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
return playerData.firstName, playerData.lastName return playerData.firstName, playerData.lastName
end end
---comment
---@return string
---@return string
---@return string
---@return string
Framework.GetPlayerJob = function() Framework.GetPlayerJob = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
end end
---comment
---@param item string
---@return boolean
Framework.HasItem = function(item) Framework.HasItem = function(item)
local hasItem = ESX.SearchInventory(item, true) local hasItem = ESX.SearchInventory(item, true)
return hasItem > 0 and true or false return hasItem > 0 and true or false
end end
---comment
---@return table
Framework.GetPlayerInventory = function() Framework.GetPlayerInventory = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
return playerData.inventory return playerData.inventory
end end
---comment
---@return boolean
Framework.GetIsPlayerDead = function() Framework.GetIsPlayerDead = function()
local playerData = ESX.GetPlayerData() local playerData = ESX.GetPlayerData()
return playerData.dead return playerData.dead
+31 -2
View File
@@ -10,6 +10,7 @@ end
Framework.GetPlayerDob = function(src) Framework.GetPlayerDob = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
local dob = xPlayer.get("dateofbirth") local dob = xPlayer.get("dateofbirth")
return dob return dob
end end
@@ -18,6 +19,7 @@ end
-- Returns the citizen ID of the player. -- Returns the citizen ID of the player.
Framework.GetPlayerIdentifier = function(src) Framework.GetPlayerIdentifier = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getIdentifier() return xPlayer.getIdentifier()
end end
@@ -25,6 +27,7 @@ end
-- Returns the first and last name of the player. -- Returns the first and last name of the player.
Framework.GetPlayerName = function(src) Framework.GetPlayerName = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.variables.firstName, xPlayer.variables.lastName return xPlayer.variables.firstName, xPlayer.variables.lastName
end end
@@ -32,7 +35,9 @@ end
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory. -- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, _) Framework.GetItem = function(src, item, _)
local playerItems = ESX.GetPlayerFromId(src).getInventory() local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
local playerItems = xPlayer.getInventory()
local repackedTable = {} local repackedTable = {}
for _, v in pairs(playerItems) do for _, v in pairs(playerItems) do
if v.name == item then if v.name == item then
@@ -51,14 +56,26 @@ end
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory. -- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
Framework.GetItemCount = function(src, item, _) Framework.GetItemCount = function(src, item, _)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getInventoryItem(item).count return xPlayer.getInventoryItem(item).count
end end
---comment
---@param src number
---@param item string
---@return boolean
Framework.HasItem = function(src, item)
local getCount = Framework.GetItemCount(src, item, nil)
return getCount > 0
end
-- Framework.GetPlayerInventory(src) -- Framework.GetPlayerInventory(src)
-- Returns the entire inventory of the player as a table. -- Returns the entire inventory of the player as a table.
-- returns {name = v.name, count = v.amount, _, _} -- returns {name = v.name, count = v.amount, _, _}
Framework.GetPlayerInventory = function(src) Framework.GetPlayerInventory = function(src)
local playerItems = ESX.GetPlayerFromId(src).getInventory() local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
local playerItems = xPlayer.getInventory()
local repackedTable = {} local repackedTable = {}
for _, v in pairs(playerItems) do for _, v in pairs(playerItems) do
if v.count > 0 then if v.count > 0 then
@@ -77,6 +94,7 @@ end
-- 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.
Framework.SetPlayerMetadata = function(src, metadata, value) Framework.SetPlayerMetadata = function(src, metadata, value)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
xPlayer.setMeta(metadata, value, nil) xPlayer.setMeta(metadata, value, nil)
return true return true
end end
@@ -85,6 +103,7 @@ end
-- Gets the specified metadata key and value to the player's data. -- Gets the specified metadata key and value to the player's data.
Framework.GetPlayerMetadata = function(src, metadata) Framework.GetPlayerMetadata = function(src, metadata)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getMeta(metadata) or false return xPlayer.getMeta(metadata) or false
end end
@@ -95,6 +114,7 @@ end
-- phone_number, pincode -- phone_number, pincode
Framework.GetStatus = function(src, column) Framework.GetStatus = function(src, column)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.get(column) or nil return xPlayer.get(column) or nil
end end
@@ -132,6 +152,7 @@ end
-- Returns the phone number of the player. -- Returns the phone number of the player.
Framework.GetPlayerPhone = function(src) Framework.GetPlayerPhone = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.get("phone_number") return xPlayer.get("phone_number")
end end
@@ -139,6 +160,7 @@ end
-- 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.
Framework.GetPlayerJob = function(src) Framework.GetPlayerJob = function(src)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getJob().name, xPlayer.getJob().label, xPlayer.getJob().grade_label, xPlayer.getJob().grade return xPlayer.getJob().name, xPlayer.getJob().label, xPlayer.getJob().grade_label, xPlayer.getJob().grade
end end
@@ -160,12 +182,14 @@ end
-- Sets the player's job to the specified name and grade. -- Sets the player's job to the specified name and grade.
Framework.SetPlayerJob = function(src, name, grade) Framework.SetPlayerJob = function(src, name, grade)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
if not ESX.DoesJobExist(name, grade) then lib.print.error("Job Does Not Exsist In Framework :NAME "..name.." Grade:"..grade) return end if not ESX.DoesJobExist(name, grade) then lib.print.error("Job Does Not Exsist In Framework :NAME "..name.." Grade:"..grade) return end
return xPlayer.setJob(name, grade, true) return xPlayer.setJob(name, grade, true)
end end
Framework.ToggleDuty = function(src, status) Framework.ToggleDuty = function(src, status)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
local name = xPlayer.getJob().name local name = xPlayer.getJob().name
local grade = xPlayer.getJob().grade local grade = xPlayer.getJob().grade
xPlayer.setJob(name, grade, status) xPlayer.setJob(name, grade, status)
@@ -175,6 +199,7 @@ end
-- 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)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.addAccountMoney(_type, amount) return xPlayer.addAccountMoney(_type, amount)
end end
@@ -182,6 +207,7 @@ end
-- 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.
Framework.RemoveAccountBalance = function(src, _type, amount) Framework.RemoveAccountBalance = function(src, _type, amount)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.removeAccountMoney(_type, amount) return xPlayer.removeAccountMoney(_type, amount)
end end
@@ -189,6 +215,7 @@ end
-- Returns the player's account balance of the specified type. -- Returns the player's account balance of the specified type.
Framework.GetAccountBalance = function(src, _type) Framework.GetAccountBalance = function(src, _type)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.getAccount(_type).money return xPlayer.getAccount(_type).money
end end
@@ -196,6 +223,7 @@ end
-- Adds the specified item to the player's inventory. -- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata) Framework.AddItem = function(src, item, amount, slot, metadata)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.addInventoryItem(item, amount) return xPlayer.addInventoryItem(item, amount)
end end
@@ -203,6 +231,7 @@ end
-- Removes the specified item from the player's inventory. -- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata) Framework.RemoveItem = function(src, item, amount, slot, metadata)
local xPlayer = ESX.GetPlayerFromId(src) local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
return xPlayer.removeInventoryItem(item, amount) return xPlayer.removeInventoryItem(item, amount)
end end
+37 -1
View File
@@ -13,6 +13,7 @@ end
-- Returns the citizen ID of the player. -- Returns the citizen ID of the player.
Framework.GetPlayerIdentifier = function(src) Framework.GetPlayerIdentifier = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.citizenid return playerData.citizenid
end end
@@ -21,12 +22,14 @@ end
-- Returns the first and last name of the player. -- Returns the first and last name of the player.
Framework.GetPlayerName = function(src) Framework.GetPlayerName = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.charinfo.firstname, playerData.charinfo.lastname return playerData.charinfo.firstname, playerData.charinfo.lastname
end end
Framework.GetPlayerDob = function(src) Framework.GetPlayerDob = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.charinfo.birthdate return playerData.charinfo.birthdate
end end
@@ -36,6 +39,7 @@ end
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, metadata) Framework.GetItem = function(src, item, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local playerInventory = playerData.items local playerInventory = playerData.items
local repackedTable = {} local repackedTable = {}
@@ -56,6 +60,7 @@ end
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory. -- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
Framework.GetItemCount = function(src, item, metadata) Framework.GetItemCount = function(src, item, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local playerInventory = playerData.items local playerInventory = playerData.items
local count = 0 local count = 0
@@ -67,11 +72,21 @@ Framework.GetItemCount = function(src, item, metadata)
return count return count
end end
---comment
---@param src number
---@param item string
---@return boolean
Framework.HasItem = function(src, item)
local getCount = Framework.GetItemCount(src, item, nil)
return getCount > 0
end
-- Framework.GetPlayerInventory(src) -- Framework.GetPlayerInventory(src)
-- Returns the entire inventory of the player as a table. -- Returns the entire inventory of the player as a table.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetPlayerInventory = function(src) Framework.GetPlayerInventory = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local playerInventory = playerData.items local playerInventory = playerData.items
local repackedTable = {} local repackedTable = {}
@@ -88,6 +103,7 @@ end
Framework.GetItemBySlot = function(src, slot) Framework.GetItemBySlot = function(src, slot)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local playerInventory = playerData.items local playerInventory = playerData.items
local repack = {} local repack = {}
@@ -112,6 +128,7 @@ end
-- 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.
Framework.SetPlayerMetadata = function(src, metadata, value) Framework.SetPlayerMetadata = function(src, metadata, value)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
player.Functions.SetMetaData(metadata, value) player.Functions.SetMetaData(metadata, value)
return true return true
end end
@@ -120,6 +137,7 @@ end
-- Gets the specified metadata key to the player's data. -- Gets the specified metadata key to the player's data.
Framework.GetPlayerMetadata = function(src, metadata) Framework.GetPlayerMetadata = function(src, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.metadata[metadata] or false return playerData.metadata[metadata] or false
end end
@@ -128,6 +146,7 @@ end
-- 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.
Framework.AddStress = function(src, value) Framework.AddStress = function(src, value)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newStress = playerData.metadata.stress + value local newStress = playerData.metadata.stress + value
player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100))
@@ -139,6 +158,7 @@ end
-- 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.
Framework.RemoveStress = function(src, value) Framework.RemoveStress = function(src, value)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newStress = (playerData.metadata.stress or 0) - value local newStress = (playerData.metadata.stress or 0) - value
player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100))
@@ -150,6 +170,7 @@ end
-- Adds the specified value from the player's hunger level. -- Adds the specified value from the player's hunger level.
Framework.AddHunger = function(src, value) Framework.AddHunger = function(src, value)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
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))
@@ -161,6 +182,7 @@ end
-- Adds the specified value from the player's thirst level. -- Adds the specified value from the player's thirst level.
Framework.AddThirst = function(src, value) Framework.AddThirst = function(src, value)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
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))
@@ -170,6 +192,7 @@ end
Framework.GetHunger = function(src) Framework.GetHunger = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0) local newHunger = (playerData.metadata.hunger or 0)
return newHunger return newHunger
@@ -177,6 +200,7 @@ end
Framework.GetThirst = function(src) Framework.GetThirst = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0) local newThirst = (playerData.metadata.thirst or 0)
return newThirst return newThirst
@@ -186,6 +210,7 @@ end
-- Returns the phone number of the player. -- Returns the phone number of the player.
Framework.GetPlayerPhone = function(src) Framework.GetPlayerPhone = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.charinfo.phone return playerData.charinfo.phone
end end
@@ -194,6 +219,7 @@ end
-- Returns the gang name of the player. -- Returns the gang name of the player.
Framework.GetPlayerGang = function(src) Framework.GetPlayerGang = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.gang.name return playerData.gang.name
end end
@@ -216,6 +242,7 @@ end
-- 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.
Framework.GetPlayerJob = function(src) Framework.GetPlayerJob = function(src)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
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
@@ -224,11 +251,13 @@ end
-- Sets the player's job to the specified name and grade. -- Sets the player's job to the specified name and grade.
Framework.SetPlayerJob = function(src, name, grade) Framework.SetPlayerJob = function(src, name, grade)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
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) Framework.ToggleDuty = function(src, status)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
player.Functions.SetJobDuty(status) player.Functions.SetJobDuty(status)
TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty) TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty)
end end
@@ -237,6 +266,7 @@ end
-- 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)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
if _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return player.Functions.AddMoney(_type, amount) return player.Functions.AddMoney(_type, amount)
end end
@@ -245,6 +275,7 @@ end
-- 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.
Framework.RemoveAccountBalance = function(src, _type, amount) Framework.RemoveAccountBalance = function(src, _type, amount)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
if _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return player.Functions.RemoveMoney(_type, amount) return player.Functions.RemoveMoney(_type, amount)
end end
@@ -252,7 +283,9 @@ end
-- Framework.GetAccountBalance(src, _type) -- Framework.GetAccountBalance(src, _type)
-- Returns the player's account balance of the specified type. -- Returns the player's account balance of the specified type.
Framework.GetAccountBalance = function(src, _type) Framework.GetAccountBalance = function(src, _type)
local playerData = QBCore.Functions.GetPlayer(src).PlayerData local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
if _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return playerData.money[_type] return playerData.money[_type]
end end
@@ -261,6 +294,7 @@ end
-- Adds the specified item to the player's inventory. -- Adds the specified item to the player's inventory.
Framework.AddItem = function(src, item, amount, slot, metadata) Framework.AddItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata) return player.Functions.AddItem(item, amount, slot, metadata)
end end
@@ -269,6 +303,7 @@ end
-- Removes the specified item from the player's inventory. -- Removes the specified item from the player's inventory.
Framework.RemoveItem = function(src, item, amount, slot, metadata) Framework.RemoveItem = function(src, item, amount, slot, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot or nil) return player.Functions.RemoveItem(item, amount, slot or nil)
end end
@@ -278,6 +313,7 @@ end
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way -- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
Framework.SetMetadata = function(src, item, slot, metadata) Framework.SetMetadata = function(src, item, slot, metadata)
local player = QBCore.Functions.GetPlayer(src) local player = QBCore.Functions.GetPlayer(src)
if not player then return end
local slotFinder = Framework.GetPlayerInventory(src) local slotFinder = Framework.GetPlayerInventory(src)
local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder) local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder)
local itemSlot = slot or nil local itemSlot = slot or nil
+50 -9
View File
@@ -9,14 +9,18 @@ Framework.GetFrameworkName = function()
end end
Framework.GetPlayerDob = function(src) Framework.GetPlayerDob = function(src)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
return playerData.charinfo.birthdate return playerData.charinfo.birthdate
end end
-- Framework.GetPlayerIdentifier(src) -- Framework.GetPlayerIdentifier(src)
-- Returns the citizen ID of the player. -- Returns the citizen ID of the player.
Framework.GetPlayerIdentifier = function(src) Framework.GetPlayerIdentifier = function(src)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
if not playerData then return false end if not playerData then return false end
return playerData.citizenid return playerData.citizenid
end end
@@ -24,7 +28,9 @@ end
-- Framework.GetPlayerName(src) -- Framework.GetPlayerName(src)
-- Returns the first and last name of the player. -- Returns the first and last name of the player.
Framework.GetPlayerName = function(src) Framework.GetPlayerName = function(src)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
return playerData.charinfo.firstname, playerData.charinfo.lastname return playerData.charinfo.firstname, playerData.charinfo.lastname
end end
@@ -32,7 +38,9 @@ end
-- Returns a table of items matching the specified name and if passed metadata from the player's inventory. -- Returns a table of items matching the specified name and if passed metadata from the player's inventory.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetItem = function(src, item, metadata) Framework.GetItem = function(src, item, metadata)
local playerInventory = QBox:GetPlayer(src).PlayerData.items local player = QBox:GetPlayer(src)
if not player then return end
local playerInventory = player.PlayerData.items
local repackedTable = {} local repackedTable = {}
for _, v in pairs(playerInventory) do for _, v in pairs(playerInventory) do
if v.name == item and (not metadata or v.info == metadata) then if v.name == item and (not metadata or v.info == metadata) then
@@ -50,7 +58,9 @@ end
-- Framework.GetItemCount(src, item, metadata) -- Framework.GetItemCount(src, item, metadata)
-- Returns the count of items matching the specified name and if passed metadata from the player's inventory. -- Returns the count of items matching the specified name and if passed metadata from the player's inventory.
Framework.GetItemCount = function(src, item, metadata) Framework.GetItemCount = function(src, item, metadata)
local playerInventory = QBox:GetPlayer(src).PlayerData.items local player = QBox:GetPlayer(src)
if not player then return end
local playerInventory = player.PlayerData.items
local count = 0 local count = 0
for _, v in pairs(playerInventory) do for _, v in pairs(playerInventory) do
if v.name == item and (not metadata or v.info == metadata) then if v.name == item and (not metadata or v.info == metadata) then
@@ -60,11 +70,22 @@ Framework.GetItemCount = function(src, item, metadata)
return count return count
end end
---comment
---@param src number
---@param item string
---@return boolean
Framework.HasItem = function(src, item)
local getCount = Framework.GetItemCount(src, item, nil)
return getCount > 0
end
-- Framework.GetPlayerInventory(src) -- Framework.GetPlayerInventory(src)
-- Returns the entire inventory of the player as a table. -- Returns the entire inventory of the player as a table.
-- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot}
Framework.GetPlayerInventory = function(src) Framework.GetPlayerInventory = function(src)
local playerItems = QBox:GetPlayer(src).PlayerData.items local player = QBox:GetPlayer(src)
if not player then return end
local playerItems = player.PlayerData.items
local repackedTable = {} local repackedTable = {}
for _, v in pairs(playerItems) do for _, v in pairs(playerItems) do
table.insert(repackedTable, { table.insert(repackedTable, {
@@ -81,6 +102,7 @@ end
-- 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.
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
player.Functions.SetMetaData(metadata, value) player.Functions.SetMetaData(metadata, value)
return true return true
end end
@@ -89,6 +111,7 @@ end
-- Gets the specified metadata key to the player's data. -- Gets the specified metadata key to the player's data.
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
local playerData = player.PlayerData local playerData = player.PlayerData
return playerData.metadata[metadata] or false return playerData.metadata[metadata] or false
end end
@@ -97,6 +120,7 @@ end
-- 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.
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
local playerData = player.PlayerData local playerData = player.PlayerData
local newStress = playerData.metadata.stress + value local newStress = playerData.metadata.stress + value
player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100))
@@ -108,6 +132,7 @@ end
-- 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.
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
local playerData = player.PlayerData local playerData = player.PlayerData
local newStress = (playerData.metadata.stress or 0) - value local newStress = (playerData.metadata.stress or 0) - value
player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100))
@@ -119,6 +144,7 @@ end
-- Adds the specified value from the player's hunger level. -- Adds the specified value from the player's hunger level.
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
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))
@@ -130,6 +156,7 @@ end
-- Adds the specified value from the player's thirst level. -- Adds the specified value from the player's thirst level.
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
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))
@@ -139,6 +166,7 @@ end
Framework.GetHunger = function(src) Framework.GetHunger = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newHunger = (playerData.metadata.hunger or 0) local newHunger = (playerData.metadata.hunger or 0)
return newHunger return newHunger
@@ -146,6 +174,7 @@ end
Framework.GetThirst = function(src) Framework.GetThirst = function(src)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData local playerData = player.PlayerData
local newThirst = (playerData.metadata.thirst or 0) local newThirst = (playerData.metadata.thirst or 0)
return newThirst return newThirst
@@ -154,7 +183,9 @@ end
-- Framework.GetPlayerPhone(src) -- Framework.GetPlayerPhone(src)
-- Returns the phone number of the player. -- Returns the phone number of the player.
Framework.GetPlayerPhone = function(src) Framework.GetPlayerPhone = function(src)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
return playerData.charinfo.phone return playerData.charinfo.phone
end end
@@ -187,11 +218,14 @@ end
-- Sets the player's job to the specified name and grade. -- Sets the player's job to the specified name and grade.
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
return player.Functions.SetJob(name, grade) return player.Functions.SetJob(name, grade)
end end
Framework.ToggleDuty = function(src, status) Framework.ToggleDuty = function(src, status)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
QBox:SetJobDuty(playerData.citizenid, status) QBox:SetJobDuty(playerData.citizenid, status)
end end
@@ -199,6 +233,7 @@ end
-- 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)
local player = QBox:GetPlayer(src) local player = QBox:GetPlayer(src)
if not player then return end
if _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return player.Functions.AddMoney(_type, amount) return player.Functions.AddMoney(_type, amount)
end end
@@ -207,6 +242,7 @@ end
-- 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.
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 _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return player.Functions.RemoveMoney(_type, amount) return player.Functions.RemoveMoney(_type, amount)
end end
@@ -214,7 +250,9 @@ end
-- Framework.GetAccountBalance(src, _type) -- Framework.GetAccountBalance(src, _type)
-- Returns the player's account balance of the specified type. -- Returns the player's account balance of the specified type.
Framework.GetAccountBalance = function(src, _type) Framework.GetAccountBalance = function(src, _type)
local playerData = QBox:GetPlayer(src).PlayerData local player = QBox:GetPlayer(src)
if not player then return end
local playerData = player.PlayerData
if _type == 'money' then _type = 'cash' end if _type == 'money' then _type = 'cash' end
return playerData.money[_type] return playerData.money[_type]
end end
@@ -223,6 +261,7 @@ end
-- Adds the specified item to the player's inventory. -- Adds the specified item to the player's inventory.
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
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.AddItem(item, amount, slot, metadata) return player.Functions.AddItem(item, amount, slot, metadata)
end end
@@ -231,6 +270,7 @@ end
-- Removes the specified item from the player's inventory. -- Removes the specified item from the player's inventory.
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
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return player.Functions.RemoveItem(item, amount, slot) return player.Functions.RemoveItem(item, amount, slot)
end end
@@ -240,6 +280,7 @@ end
-- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way -- Notes, this is kinda a jank workaround. with the framework aside from updating the entire table theres not really a better way
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
player.Functions.RemoveItem(item, 1, slot) player.Functions.RemoveItem(item, 1, slot)
return player.Functions.AddItem(item, 1, slot, metadata) return player.Functions.AddItem(item, 1, slot, metadata)
end end
-12
View File
@@ -1,12 +0,0 @@
if GetResourceState('BigDaddy-Fuel') ~= 'started' then return end
Fuel = Fuel or {}
Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return exports['BigDaddy-Fuel']:GetFuel(vehicle)
end
Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end
exports['BigDaddy-Fuel']:SetFuel(vehicle, fuel)
end
+1 -1
View File
@@ -1,5 +1,5 @@
Fuel = Fuel or {} Fuel = Fuel or {}
----print("Fuel: Loading Defualt")
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 GetVehicleFuelLevel(vehicle) return GetVehicleFuelLevel(vehicle)
+17
View File
@@ -0,0 +1,17 @@
local resourceName = "BigDaddy-Fuel"
local configValue = BridgeClientConfig.Fuel
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.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return exports['BigDaddy-Fuel']:GetFuel(vehicle)
end
Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end
exports['BigDaddy-Fuel']:SetFuel(vehicle, fuel)
end
+6 -2
View File
@@ -1,4 +1,8 @@
if GetResourceState('cdn-fuel') ~= 'started' then return end local resourceName = "cdn-fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
@@ -6,7 +10,7 @@ Fuel.GetFuel = function(vehicle)
return exports['cdn-fuel']:GetFuel(vehicle) return exports['cdn-fuel']:GetFuel(vehicle)
end end
Fuel.SetFuel = function(vehicle, fuel, type) 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)
end end
+5 -1
View File
@@ -1,4 +1,8 @@
if GetResourceState('esx-sna-fuel') ~= 'started' then return end local resourceName = "esx-sna-fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
+15
View File
@@ -0,0 +1,15 @@
local resourceName = "lc_fuel"
local configValue = BridgeClientConfig.Fuel
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Fuel: Loading lc_fuel")
Fuel = Fuel or {}
Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0 end
return exports["lc_fuel"]:GetFuel(vehicle)
end
Fuel.SetFuel = function(vehicle, fuel)
if not DoesEntityExist(vehicle) then return end
return exports["lc_fuel"]:SetFuel(vehicle, fuel)
end
@@ -1,4 +1,8 @@
if GetResourceState('LegacyFuel') ~= 'started' then return end local resourceName = "LegacyFuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
+4 -1
View File
@@ -1,4 +1,7 @@
if GetResourceState('okokGasStation') ~= 'started' then return end local resourceName = "okokGasStation"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
+4 -1
View File
@@ -1,4 +1,7 @@
if GetResourceState('cdn-fuel') ~= 'started' then return end local resourceName = "ox_fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
+6 -3
View File
@@ -1,12 +1,15 @@
if GetResourceState('ps-fuel') ~= 'started' then return end local resourceName = "ps-fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
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
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)
end end
+4 -1
View File
@@ -1,4 +1,7 @@
if GetResourceState('qs-fuelstations') ~= 'started' then return end local resourceName = "qs-fuelstations"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
@@ -1,4 +1,7 @@
if GetResourceState('Renewed-Fuel') ~= 'started' then return end local resourceName = "Renewed-Fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
+9 -6
View File
@@ -1,13 +1,16 @@
if GetResourceState('ti_fuel') ~= 'started' then return end local resourceName = "ti_fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0, type end if not DoesEntityExist(vehicle) then return 0.0 end
local level, type = exports["ti_fuel"]:getFuel(vehicle) local level, _ = exports["ti_fuel"]:getFuel(vehicle)
return level, type return level
end end
Fuel.SetFuel = function(vehicle, fuel, type) 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, type or "RON91") return exports['ti_fuel']:setFuel(vehicle, fuel, "RON91")
end end
+8 -5
View File
@@ -1,13 +1,16 @@
if GetResourceState('x-fuel') ~= 'started' then return end local resourceName = "x-fuel"
local configValue = BridgeClientConfig.Fuel
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 {}
Fuel.GetFuel = function(vehicle) Fuel.GetFuel = function(vehicle)
if not DoesEntityExist(vehicle) then return 0.0, type end if not DoesEntityExist(vehicle) then return 0.0 end
local level, type = exports["x-fuel"]:getFuel(vehicle) local level, _ = exports["x-fuel"]:getFuel(vehicle)
return level, type return level
end end
Fuel.SetFuel = function(vehicle, fuel, type) 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)
end end
+9 -1
View File
@@ -1,14 +1,22 @@
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
print('client funct')
return Framework.GetItemInfo(item) return Framework.GetItemInfo(item)
end end
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return Framework.HasItem(item) return Framework.HasItem(item)
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end end
+48
View File
@@ -1,38 +1,86 @@
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
return Framework.AddItem(src, item, count, slot, metadata) return Framework.AddItem(src, item, count, slot, metadata)
end end
---comment
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
item = type(item) == "table" and item.name or item item = type(item) == "table" and item.name or item
return Framework.RemoveItem(src, item, count, slot, metadata) return Framework.RemoveItem(src, item, count, slot, metadata)
end end
---comment
---@param item string
---@return boolean
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
return false, print("This Inventory Has Not Been Bridged For An Item Info Feature.") return false, print("This Inventory Has Not Been Bridged For An Item Info Feature.")
end end
---comment
---@param src number
---@param item string
---@param metadata table
---@return number
Inventory.GetItemCount = function(src, item, metadata) Inventory.GetItemCount = function(src, item, metadata)
return Framework.GetItemCount(src, item, metadata) return Framework.GetItemCount(src, item, metadata)
end end
---comment
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
return Framework.GetPlayerInventory(src) return Framework.GetPlayerInventory(src)
end end
---comment
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
return Framework.GetItemBySlot(src, slot) return Framework.GetItemBySlot(src, slot)
end end
---comment
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return boolean
Inventory.SetMetadata = function(src, item, slot, metadata) Inventory.SetMetadata = function(src, item, slot, metadata)
return Framework.SetMetadata(src, item, slot, metadata) return Framework.SetMetadata(src, item, slot, metadata)
end end
---comment
---@param src number
---@param id string||number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
return false, print("This Inventory Has Not Been Bridged For A Stash Feature.") return false, print("This Inventory Has Not Been Bridged For A Stash Feature.")
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
return "https://avatars.githubusercontent.com/u/47620135" return "https://avatars.githubusercontent.com/u/47620135"
end end
@@ -3,6 +3,9 @@ Inventory = Inventory or {}
local codem = exports['codem-inventory'] local codem = exports['codem-inventory']
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = codem:GetItemList(item) local itemData = codem:GetItemList(item)
local repackedTable = { local repackedTable = {
@@ -16,6 +19,8 @@ Inventory.GetItemInfo = function(item)
return repackedTable or {} return repackedTable or {}
end end
---comment
---@return table
Inventory.GetPlayerInventory = function() Inventory.GetPlayerInventory = function()
local items = {} local items = {}
local inventory = codem:getUserInventory() local inventory = codem:getUserInventory()
@@ -34,6 +39,9 @@ Inventory.GetPlayerInventory = function()
return items return items
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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)
@@ -60,6 +60,14 @@ Inventory.SetMetadata = function(src, item, slot, metadata)
return codem:SetItemMetadata(src, slot, metadata) return codem:SetItemMetadata(src, slot, metadata)
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
return codem:HasItem(src, item, 1)
end
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local slotData = codem:GetItemBySlot(src, slot) local slotData = codem:GetItemBySlot(src, slot)
if not slotData then return {} end if not slotData then return {} end
@@ -82,3 +90,4 @@ Inventory.GetImagePath = function(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"
end end
@@ -6,6 +6,9 @@ local core = exports.core_inventory
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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)
@@ -4,12 +4,19 @@ Inventory = Inventory or {}
local core = exports.core_inventory local core = exports.core_inventory
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item)) local file = LoadResourceFile("core_inventory", string.format("html/img/%s.png", item))
local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item) local imagePath = file and string.format("nui://core_inventory/html/img/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---comment
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
-- have no clue if this will work but fingers crossed -- have no clue if this will work but fingers crossed
local queries = { local queries = {
@@ -9,10 +9,16 @@ RegisterNetEvent('community_bridge:client:jpr-inventory:openStash', function(id,
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return jpr:HasItem(item) return jpr:HasItem(item)
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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)
@@ -4,26 +4,64 @@ local jpr = exports['jpr-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param id string||number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return true return true
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
return jpr:HasItem(src, item, 1)
end
---comment
---@param src number
---@param id string||number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots }) TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots })
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("jpr-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://jpr-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---comment
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local slotData = jpr:GetItemBySlot(src, slot) local slotData = jpr:GetItemBySlot(src, slot)
if not slotData then return {} end if not slotData then return {} end
return { name = slotData.name, label = slotData.label, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description } return { name = slotData.name, label = slotData.label, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description }
end end
---comment
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
local queries = { local queries = {
'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate', 'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
@@ -35,3 +73,26 @@ Inventory.UpdatePlate = function(oldplate, newplate)
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
return true return true
end end
local registeredShops = {}
Inventory.OpenShop = function(src, shopTitle)
return jpr:OpenShop(src, shopTitle)
end
Inventory.CreateShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end
local repackItems = {}
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
for k, v in pairs(shopInventory) do
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
end
jpr:CreateShop(repackedShopItems)
registeredShops[shopTitle] = true
--Inventory.OpenShop(src, shopTitle)
return true
end
@@ -4,6 +4,9 @@ Inventory = Inventory or {}
local origin = exports.origen_inventory local origin = exports.origen_inventory
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = origin:Items(item) local itemData = origin:Items(item)
local repackedTable = { local repackedTable = {
@@ -17,16 +20,24 @@ Inventory.GetItemInfo = function(item)
return repackedTable or {} return repackedTable or {}
end end
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return origin:HasItem(item) return origin:HasItem(item)
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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"
end end
---comment
---@return table
Inventory.GetPlayerInventory = function() Inventory.GetPlayerInventory = function()
local items = {} local items = {}
local inventory = origin:GetInventory() local inventory = origin:GetInventory()
@@ -14,6 +14,15 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata)
return origen_inventory:removeItem(src, item, count, metadata, slot, true) return origen_inventory:removeItem(src, item, count, metadata, slot, true)
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
local count = origen_inventory:getItemCount(src , item)
return count > 0
end
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = origen_inventory:Items(item) local itemData = origen_inventory:Items(item)
local repackedTable = { local repackedTable = {
+15
View File
@@ -3,6 +3,9 @@ local ox_inventory = exports.ox_inventory
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = ox_inventory:Items(item) local itemData = ox_inventory:Items(item)
if not itemData then return {} end if not itemData then return {} end
@@ -17,20 +20,32 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
local itemCount = ox_inventory:Search('count', item) local itemCount = ox_inventory:Search('count', item)
local hasItem = itemCount ~= 0 local hasItem = itemCount ~= 0
return hasItem return hasItem
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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"
end end
---comment
---@return table
Inventory.GetPlayerInventory = function() Inventory.GetPlayerInventory = function()
return exports.ox_inventory:GetPlayerItems() return exports.ox_inventory:GetPlayerItems()
end end
Inventory.OpenShop = function(shopTitle, shopInventory)
ox_inventory:openInventory("shop", { type = shopTitle, id = 1 })
end
--Bridge.RegisterModule("Inventory", Inventory) --Bridge.RegisterModule("Inventory", Inventory)
+97 -2
View File
@@ -4,44 +4,111 @@ local ox_inventory = exports.ox_inventory
Inventory = Inventory or {} Inventory = Inventory or {}
---This will add an item, and return true or false based on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return ox_inventory:AddItem(src, item, count, metadata) return ox_inventory:AddItem(src, item, count, metadata)
end end
---This will remove an item, and return true or false based on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return ox_inventory:RemoveItem(src, item, count, metadata, slot) return ox_inventory:RemoveItem(src, item, count, metadata, slot)
end end
---comment
---@param src number
---@param item string
---@param metadata table
---@return table
Inventory.GetItem = function(src, item, metadata) Inventory.GetItem = function(src, item, metadata)
return ox_inventory:GetItem(src, item, metadata, false) return ox_inventory:GetItem(src, item, metadata, false)
end end
---comment
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
return ox_inventory:GetSlot(src, slot) return ox_inventory:GetSlot(src, slot)
end end
---comment
---@param src number
---@param item string
---@param metadata table
---@return number
Inventory.GetItemCount = function(src, item, metadata) Inventory.GetItemCount = function(src, item, metadata)
return ox_inventory:GetItemCount(src, item, metadata, false) return ox_inventory:GetItemCount(src, item, metadata, false)
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
local count = ox_inventory:GetItemCount(src, item, nil, false)
return count > 0
end
---comment
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
return ox_inventory:GetInventoryItems(src, false) return ox_inventory:GetInventoryItems(src, false)
end end
---comment
---@param src number
---@param item string
---@param count number
---@return boolean
Inventory.CanCarryItem = function(src, item, count) Inventory.CanCarryItem = function(src, item, count)
return ox_inventory:CanCarryItem(src, item, count) return ox_inventory:CanCarryItem(src, item, count)
end end
---comment
---@param id number||string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return ox_inventory:RegisterStash(id, label, slots, weight, owner) return ox_inventory:RegisterStash(id, label, slots, weight, owner)
end end
---comment
---@param src number
---@param id number||string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('ox_inventory:openInventory', src, 'stash', 'stash_' .. id) TriggerClientEvent('ox_inventory:openInventory', src, 'stash', 'stash_' .. id)
end end
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = ox_inventory:Items(item) local itemData = ox_inventory:Items(item)
if not itemData then return {} end if not itemData then return {} end
@@ -51,23 +118,51 @@ Inventory.GetItemInfo = function(item)
stack = itemData.stack or "true", stack = itemData.stack or "true",
weight = itemData.weight or "0", weight = itemData.weight or "0",
description = itemData.description or "none", description = itemData.description or "none",
image = itemData.client.image or Inventory.GetImagePath(item), image = itemData.client and itemData.client.image or Inventory.GetImagePath(item),
} }
return repackedTable return repackedTable
end end
---comment
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return nil
Inventory.SetMetadata = function(src, item, slot, metadata) Inventory.SetMetadata = function(src, item, slot, metadata)
ox_inventory:SetMetadata(src, slot, metadata) ox_inventory:SetMetadata(src, slot, metadata)
end end
---comment
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
ox_inventory:UpdateVehicle(oldplate, newplate) ox_inventory:UpdateVehicle(oldplate, newplate)
if GetResourceState('jg-mechanic') ~= 'started' then return end if GetResourceState('jg-mechanic') ~= 'started' then return true end
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
return true
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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"
end end
local registeredShops = {}
Inventory.OpenShop = function(src, shopTitle)
TriggerClientEvent('ox_inventory:openInventory', src, 'shop', {type = shopTitle})
end
Inventory.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = true
ox_inventory:RegisterShop(shopTitle, { name = shopTitle, inventory = shopInventory, groups = shopGroups, })
--return Inventory.OpenShop(src, shopTitle)
return true
end
@@ -10,10 +10,17 @@ RegisterNetEvent('community_bridge:client:ps-inventory:openStash', function(id,
TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('ps-inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return ps:HasItem(item) return ps:HasItem(item)
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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)
+79 -2
View File
@@ -4,38 +4,93 @@ local sloth = exports['ps-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param id string||number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return true return true
end end
---comment
---@param src number
---@param id string||number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = label, maxweight = weight, slots = slots, }) TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = label, maxweight = weight, slots = slots, })
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("ps-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://ps-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
return sloth:HasItem(src, item, 1)
end
---comment
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local slotData = sloth:GetItemBySlot(src, slot) local slotData = sloth:GetItemBySlot(src, slot)
if not slotData then return {} end if not slotData then return {} end
return {name = slotData.name, label = slotData.name, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description} return {name = slotData.name, label = slotData.name, weight = slotData.weight, slot = slot, count = slotData.amount, metadata = slotData.info, stack = slotData.unique, description = slotData.description}
end end
---comment
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, amount, slot, metadata) Inventory.AddItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add') TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'add')
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = amount, slot = slot, metadata = metadata})
return exports['ps-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge') return sloth:AddItem(src, item, amount, slot, metadata, 'community_bridge')
end end
---comment
---@param src number
---@param item string
---@param amount number
---@param slot number
---@param metadata table
---@return boolean
Inventory.RemoveItem = function(src, item, amount, slot, metadata) Inventory.RemoveItem = function(src, item, amount, slot, metadata)
TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove') TriggerClientEvent('ps-inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove')
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return exports['ps-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge') return sloth:RemoveItem(src, item, amount, slot, 'community_bridge')
end end
---comment
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
local queries = { local queries = {
'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate', 'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate',
@@ -47,3 +102,25 @@ Inventory.UpdatePlate = function(oldplate, newplate)
exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate)
return true return true
end end
local registeredShops = {}
Inventory.OpenShop = function(src, shopTitle)
return sloth:OpenShop(src, shopTitle)
end
Inventory.CreateShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end
local repackItems = {}
local repackedShopItems = {name = shopTitle, label = shopTitle, coords = shopCoords, items = repackItems, slots = #shopInventory, }
for k, v in pairs(shopInventory) do
table.insert(repackItems, { name = v.name, price = v.price or 1000, amount = v.count or 1, slot = k })
end
sloth:CreateShop(repackedShopItems)
registeredShops[shopTitle] = true
--Inventory.OpenShop(src, shopTitle)
return true
end
@@ -10,10 +10,16 @@ RegisterNetEvent('community_bridge:client:qb-inventory:openStash', function(id,
TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots }) TriggerServerEvent('inventory:server:OpenInventory', 'stash', id, { maxweight = data.weight, slots = data.slots })
end) end)
---This will return a boolean if the player has the item in their inventory
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return qb:HasItem(item) return qb:HasItem(item)
end end
---This will return a string of the image path for the item
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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)
+80
View File
@@ -12,20 +12,55 @@ local function getInventoryNewVersion()
end end
end end
---comment
---@param id string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return true return true
end end
---comment
---@param src number
---@param id number||string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots }) TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots })
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(item)
local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item)) local file = LoadResourceFile("qb-inventory", string.format("html/images/%s.png", item))
local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item) local imagePath = file and string.format("nui://qb-inventory/html/images/%s.png", item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---comment
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
return qbInventory:HasItem(src, item, 1)
end
---comment
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local slotData = qbInventory:GetItemBySlot(src, slot) local slotData = qbInventory:GetItemBySlot(src, slot)
if not slotData then return {} end if not slotData then return {} end
@@ -41,6 +76,11 @@ Inventory.GetItemBySlot = function(src, slot)
} }
end end
---comment
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
local newVersion = getInventoryNewVersion() local newVersion = getInventoryNewVersion()
if newVersion then if newVersion then
@@ -79,3 +119,43 @@ Inventory.RemoveItem = function(src, item, amount, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = amount, slot = slot, metadata = metadata})
return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge') return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge')
end end
local registeredShops = {}
local v1ShopData = {}
Inventory.OpenShop = function(src, shopTitle)
local newVersion = getInventoryNewVersion()
if newVersion then
return exports['qb-inventory']:OpenShop(src, shopTitle)
else
local shopData = v1ShopData[shopTitle]
if not shopData then return false end
TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData)
end
end
Inventory.CreateShop = function(src, shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle or not shopInventory or not shopCoords then return end
if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = true
local newVersion = getInventoryNewVersion()
if newVersion then
local repackedShopItems = {}
for _, v in pairs(shopInventory) do
table.insert(repackedShopItems, {name = v.name, price = v.price, amount = v.count or 1000})
end
exports['qb-inventory']:CreateShop({ name = shopTitle, label = shopTitle, coords = shopCoords, items = repackedShopItems, })
return true
else
local shopData = { label = shopTitle, items = {}, slots = 0 }
for _, v in pairs(shopInventory) do
table.insert(shopData.items, { name = v.name, price = v.price, amount = v.count or 1000, info = {}, type = 'item' })
end
shopData.slots = #shopData.items
TriggerClientEvent("inventory:client:OpenInventory", src, "shop", shopTitle, shopData)
v1ShopData[shopTitle] = shopData
print("QB-INVENTORY: You are using an outdated version of qb-inventory, please update to the latest version. Stuff will still work but you are using litterally the most exploitable inventory in fivem.")
end
end
+14
View File
@@ -3,10 +3,16 @@ local quasar = exports["qs-inventory"]
Inventory = Inventory or {} Inventory = Inventory or {}
---comment
---@param id any
---@return nil
Inventory.OpenStash = function(id) Inventory.OpenStash = function(id)
quasar:RegisterStash(id, 50, 50000) quasar:RegisterStash(id, 50, 50000)
end end
---comment
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = quasar:GetItemList() local itemData = quasar:GetItemList()
if not itemData[item] then return {} end if not itemData[item] then return {} end
@@ -21,17 +27,25 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
---comment
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
local check = quasar:Search(item) local check = quasar:Search(item)
return check and true or false return check and true or false
end end
---comment
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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"
end end
---comment
---@return table
Inventory.GetPlayerInventory = function() Inventory.GetPlayerInventory = function()
local items = {} local items = {}
local inventory = quasar:getUserInventory() local inventory = quasar:getUserInventory()
+72
View File
@@ -4,21 +4,43 @@ local quasar = exports['qs-inventory']
Inventory = Inventory or {} Inventory = Inventory or {}
---This will add the item if found and return a boolean on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
if not quasar:CanCarryItem(src, item, count) then return false end if not quasar:CanCarryItem(src, item, count) then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return quasar:AddItem(src, item, count, slot, metadata) return quasar:AddItem(src, item, count, slot, metadata)
end end
---This will remove the item if found and return a boolean on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return quasar:RemoveItem(src, item, count, slot, metadata) return quasar:RemoveItem(src, item, count, slot, metadata)
end end
---This will return a number of the items count in the inventory
---@param src number
---@param item string
---@param metadata table
---@return number
Inventory.GetItemCount = function(src, item, metadata) Inventory.GetItemCount = function(src, item, metadata)
return quasar:GetItemTotalAmount(src, item) return quasar:GetItemTotalAmount(src, item)
end end
---This will return the player inventory in a table following ox_inventory format
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
local playerItems = quasar:GetInventory(src) local playerItems = quasar:GetInventory(src)
local repackedTable = {} local repackedTable = {}
@@ -33,6 +55,20 @@ Inventory.GetPlayerInventory = function(src)
return repackedTable return repackedTable
end end
---This will return a boolean of if the player has the item in the inventory
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
local count = quasar:GetItemTotalAmount(src, item)
if not count then return false end
return count > 0
end
---This will return the item data in the inventory based on the slot if not found will return nil
---@param src number
---@param slot number
---@return table | nil
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local playerItems = quasar:GetInventory(src) local playerItems = quasar:GetInventory(src)
for _, item in pairs(playerItems) do for _, item in pairs(playerItems) do
@@ -52,19 +88,44 @@ Inventory.GetItemBySlot = function(src, slot)
return nil return nil
end end
---This will return a boolean if the player can carry the item
---@param src number
---@param item string
---@param count number
---@return boolean
Inventory.CanCarryItem = function(src, item, count) Inventory.CanCarryItem = function(src, item, count)
return quasar:CanCarryItem(src, item, count) return quasar:CanCarryItem(src, item, count)
end end
---@param id string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords) Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
return true return true
end end
---@param src number
---@param id string
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords) Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots }) TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots })
TriggerClientEvent("inventory:client:SetCurrentStash",src, id) TriggerClientEvent("inventory:client:SetCurrentStash",src, id)
end end
---This will return the data to an item
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = quasar:GetItemList() local itemData = quasar:GetItemList()
if not itemData[item] then return {} end if not itemData[item] then return {} end
@@ -79,16 +140,27 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return boolean
Inventory.SetMetadata = function(src, item, slot, metadata) Inventory.SetMetadata = function(src, item, slot, metadata)
return quasar:SetItemMetadata(src, slot, metadata) return quasar:SetItemMetadata(src, slot, metadata)
end end
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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"
end end
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
local queries = { local queries = {
'UPDATE inventory_trunk SET plate = @newplate WHERE plate = @oldplate', 'UPDATE inventory_trunk SET plate = @newplate WHERE plate = @oldplate',
@@ -3,10 +3,14 @@ local tgiann = exports["tgiann-inventory"]
Inventory = Inventory or {} Inventory = Inventory or {}
---@param id any
---@return nil
Inventory.OpenStash = function(id) Inventory.OpenStash = function(id)
-- open stash export... not sure what it is yet. -- open stash export... not sure what it is yet.
end end
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = tgiann:GetItemList() local itemData = tgiann:GetItemList()
if not itemData[item] then return {} end if not itemData[item] then return {} end
@@ -21,10 +25,16 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
---This will return a boolean if the player has the item in the inventory
---@param item string
---@return boolean
Inventory.HasItem = function(item) Inventory.HasItem = function(item)
return tgiann:HasItem(item) return tgiann:HasItem(item)
end end
-- This will return the image path, it is incredibley useful for menus etc
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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))
@@ -32,6 +42,8 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---This will return the player inventory in a table
---@return table
Inventory.GetPlayerInventory = function() Inventory.GetPlayerInventory = function()
local items = {} local items = {}
local inventory = tgiann:GetPlayerItems() local inventory = tgiann:GetPlayerItems()
@@ -4,17 +4,36 @@ local tgiann = exports["tgiann-inventory"]
Inventory = Inventory or {} Inventory = Inventory or {}
---This Will add the item if found and return boolean on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.AddItem = function(src, item, count, slot, metadata) Inventory.AddItem = function(src, item, count, slot, metadata)
if not tgiann:CanCarryItem(src, item, count) then return false end if not tgiann:CanCarryItem(src, item, count) then return false end
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "add", item = item, count = count, slot = slot, metadata = metadata})
return tgiann:AddItem(src, item, count, slot, metadata, false) return tgiann:AddItem(src, item, count, slot, metadata, false)
end end
---This Will remove the item if found and return boolean on success
---@param src number
---@param item string
---@param count number
---@param slot number
---@param metadata table
---@return boolean
Inventory.RemoveItem = function(src, item, count, slot, metadata) Inventory.RemoveItem = function(src, item, count, slot, metadata)
TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata}) TriggerClientEvent("community_bridge:client:inventory:updateInventory", src, {action = "remove", item = item, count = count, slot = slot, metadata = metadata})
return tgiann:RemoveItem(src, item, count, slot, metadata) return tgiann:RemoveItem(src, item, count, slot, metadata)
end end
--
---@param src number
---@param item string
---@param metadata table
---@return table
Inventory.GetItem = function(src, item, metadata) Inventory.GetItem = function(src, item, metadata)
local item = tgiann:GetItemByName(src, item, metadata) local item = tgiann:GetItemByName(src, item, metadata)
item.count = item.amount item.count = item.amount
@@ -22,11 +41,27 @@ Inventory.GetItem = function(src, item, metadata)
return item return item
end end
---This will return a boolean if the player has the item in their inventory
---@param src number
---@param item string
---@return boolean
Inventory.HasItem = function(src, item)
return tgiann:HasItem(src, item, 1)
end
---This will return the count of the item in the players inventory
---@param src number
---@param item string
---@param metadata optional table
---@return number
Inventory.GetItemCount = function(src, item, metadata) Inventory.GetItemCount = function(src, item, metadata)
local _item = tgiann:GetItemByName(src, item, metadata) local _item = tgiann:GetItemByName(src, item, metadata)
return _item.amount or 0 return _item.amount or 0
end end
---This will return the players inventory in a table in the format ox_inventory uses
---@param src number
---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
local inventory = tgiann:GetPlayerItems(src) local inventory = tgiann:GetPlayerItems(src)
local items = {} local items = {}
@@ -38,20 +73,39 @@ Inventory.GetPlayerInventory = function(src)
return items return items
end end
---This will return a boolean if the player can carry the item
---@param src number
---@param item string
---@param count number
---@return boolean
Inventory.CanCarryItem = function(src, item, count) Inventory.CanCarryItem = function(src, item, count)
return tgiann:CanCarryItem(src, item, count) return tgiann:CanCarryItem(src, item, count)
end end
---comment
---@param id string or number
---@param label string
---@param slots number
---@param weight number
---@param owner string
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner) Inventory.RegisterStash = function(id, label, slots, weight, owner)
return tgiann:CreateCustomStashWithItem(id, {}) return tgiann:CreateCustomStashWithItem(id, {})
end end
---This will return the item data in the slot the item is found
---@param src number
---@param slot number
---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local item = tgiann:GetItemBySlot(src, slot) local item = tgiann:GetItemBySlot(src, slot)
if not item then return {} end if not item then return {} end
return {name = item.name, label = item.label, weight = item.weight, slot = slot, count = item.amount, metadata = item.info, stack = item.unique or false, description = item.description} return {name = item.name, label = item.label, weight = item.weight, slot = slot, count = item.amount, metadata = item.info, stack = item.unique or false, description = item.description}
end end
---This will return a table of the item data including the image (very useful for menus etc)
---@param item string
---@return table
Inventory.GetItemInfo = function(item) Inventory.GetItemInfo = function(item)
local itemData = tgiann:GetItemList() local itemData = tgiann:GetItemList()
if not itemData[item] then return {} end if not itemData[item] then return {} end
@@ -66,10 +120,20 @@ Inventory.GetItemInfo = function(item)
return repackedTable return repackedTable
end end
---This will update the item metadata for an item with the provided slot and metadata, its best to get the item first
---And then set the metadata
---@param src number
---@param item string
---@param slot number
---@param metadata table
---@return nil
Inventory.SetMetadata = function(src, item, slot, metadata) Inventory.SetMetadata = function(src, item, slot, metadata)
tgiann:UpdateItemMetadata(src, item, slot, metadata) tgiann:UpdateItemMetadata(src, item, slot, metadata)
end end
---This will return the image path for the item
---@param item string
---@return string
Inventory.GetImagePath = function(item) Inventory.GetImagePath = function(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))
@@ -77,6 +141,10 @@ Inventory.GetImagePath = function(item)
return imagePath or "https://avatars.githubusercontent.com/u/47620135" return imagePath or "https://avatars.githubusercontent.com/u/47620135"
end end
---This will update the plate to a vehicle in the inventory
---@param oldplate string
---@param newplate string
---@return boolean
Inventory.UpdatePlate = function(oldplate, newplate) Inventory.UpdatePlate = function(oldplate, newplate)
local queries = { local queries = {
'UPDATE tgiann_inventory_trunkitems SET plate = @newplate WHERE plate = @oldplate', 'UPDATE tgiann_inventory_trunkitems SET plate = @newplate WHERE plate = @oldplate',
+1 -1
View File
@@ -1,5 +1,5 @@
if GetResourceState('Renewed-Banking') ~= 'started' then return end if GetResourceState('Renewed-Banking') ~= 'started' then return end
Managment = {} Managment = Managment or {}
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['Renewed-Banking']:getAccountMoney(account) return exports['Renewed-Banking']:getAccountMoney(account)
+13
View File
@@ -0,0 +1,13 @@
Managment = Managment or {}
Managment.GetAccountMoney = function(account)
return false, print("The resource you are using does not support this function.")
end
Managment.AddAccountMoney = function(account, amount)
return false, print("The resource you are using does not support this function.")
end
Managment.RemoveAccountMoney = function(account, amount)
return false, print("The resource you are using does not support this function.")
end
+1 -1
View File
@@ -1,5 +1,5 @@
if GetResourceState('okokBanking') ~= 'started' then return end if GetResourceState('okokBanking') ~= 'started' then return end
Managment = {} Managment = Managment or {}
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['okokBanking']:GetAccount(account) return exports['okokBanking']:GetAccount(account)
+1 -1
View File
@@ -1,5 +1,5 @@
if GetResourceState('qb-banking') ~= 'started' then return end if GetResourceState('qb-banking') ~= 'started' then return end
Managment = {} Managment = Managment or {}
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['qb-banking']:GetAccountBalance(account) return exports['qb-banking']:GetAccountBalance(account)
+3 -1
View File
@@ -1,4 +1,6 @@
if GetResourceState('ox_lib') ~= 'started' or (BridgeClientConfig.MenuSystem ~= "ox" and BridgeClientConfig.MenuSystem ~= "auto") then return end local resourceName = "ox_lib"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Menus = Menus or {} Menus = Menus or {}
--- Converts a QB menu to an Ox menu. --- Converts a QB menu to an Ox menu.
---@param id string The menu ID. ---@param id string The menu ID.
+3 -1
View File
@@ -1,4 +1,6 @@
if GetResourceState('qb-menu') ~= 'started' or (BridgeClientConfig.MenuSystem ~= "qb" and BridgeClientConfig.MenuSystem ~= "auto") then return end local resourceName = "qb-menu"
local configValue = BridgeClientConfig.MenuSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--print("Loading QB Menu") --print("Loading QB Menu")
--- Converts an Ox menu to a QB menu. --- Converts an Ox menu to a QB menu.
---@param id string The menu ID. ---@param id string The menu ID.
+11
View File
@@ -2,6 +2,11 @@ Notify = Notify or {}
local notifyType = BridgeClientConfig.NotifySystem local notifyType = BridgeClientConfig.NotifySystem
local helptextType = BridgeClientConfig.ShowHelpText local helptextType = BridgeClientConfig.ShowHelpText
---comment
---@param message string
---@param _type string
---@param time number
---@return nil
Notify.SendNotify = function(message, _type, time) Notify.SendNotify = function(message, _type, time)
time = time or 3000 time = time or 3000
if notifyType == 'qb' then if notifyType == 'qb' then
@@ -20,6 +25,8 @@ Notify.SendNotify = function(message, _type, time)
return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, }) return exports['t-notify']:Alert({ style = 'info', message = message, duration = time, })
elseif notifyType == 'wasabi' then elseif notifyType == 'wasabi' then
return exports.wasabi_notify:notify(_type, message, time, _type) return exports.wasabi_notify:notify(_type, message, time, _type)
elseif notifyType == 'r_notify' then
return exports.r_notify:notify({title = 'Notification', content = message, type = _type, icon = "fas fa-check", duration = time, position = 'top-right', sound = false})
elseif notifyType == 'custom' then elseif notifyType == 'custom' then
return Prints.Error("You have not set up a custom notify in community_bridge") return Prints.Error("You have not set up a custom notify in community_bridge")
else else
@@ -27,6 +34,10 @@ Notify.SendNotify = function(message, _type, time)
end end
end end
---comment
---@param message string
---@param _position string
---@return nil
Notify.ShowHelpText = function(message, _position) Notify.ShowHelpText = function(message, _position)
if helptextType == 'ox' then if helptextType == 'ox' then
if _position == nil then _position = 'left-center' end if _position == nil then _position = 'left-center' end
+9
View File
@@ -1,9 +1,18 @@
Notify = Notify or {} Notify = Notify or {}
---comment
---@param src number
---@param message string
---@param _type string
---@param time number
Notify.SendNotify = function(src, message, _type, time) Notify.SendNotify = function(src, message, _type, time)
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time) TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
end end
---comment
---@param src number
---@param message string
---@param position string
Notify.ShowHelpText = function(src, message, position) Notify.ShowHelpText = function(src, message, position)
TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position) TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position)
end end
+9 -2
View File
@@ -1,7 +1,14 @@
if GetResourceState('gksphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "gksphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "gksphone"
local configValue = BridgeSharedConfig.Phone
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = {} Phone = Phone or {}
---comment
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message }) return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message })
end end
+13 -3
View File
@@ -1,11 +1,21 @@
if GetResourceState('gksphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "gksphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "gksphone"
local configValue = BridgeSharedConfig.Phone
Phone = {} if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param src number
---@return number||boolean
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports["gksphone"]:GetPhoneBySource(src) or false return exports["gksphone"]:GetPhoneBySource(src) or false
end end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
local data = {} local data = {}
data.sender = email data.sender = email
+9 -3
View File
@@ -1,7 +1,13 @@
if GetResourceState('lb-phone') ~= 'started' or (BridgeSharedConfig.Phone ~= "lb-phone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "lb-phone"
local configValue = BridgeSharedConfig.Phone
Phone = {} if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param email string
---@param title string
---@param message string
---@return nil
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message}) TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message})
end end
+10 -3
View File
@@ -1,11 +1,18 @@
if GetResourceState('lb-phone') ~= 'started' or (BridgeSharedConfig.Phone ~= "lb-phone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "lb-phone"
local configValue = BridgeSharedConfig.Phone
Phone = {} if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false
end end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src) local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src)
if not numberNumber then return false, Prints.Error("Could not Find Phone number") end if not numberNumber then return false, Prints.Error("Could not Find Phone number") end
+9 -3
View File
@@ -1,7 +1,13 @@
if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "qs-smartphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "qs-smartphone"
local configValue = BridgeSharedConfig.Phone
Phone = {} if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param email string
---@param title string
---@param message string
---@return nil
Phone.SendEmail = function(email, title, message) Phone.SendEmail = function(email, title, message)
return TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} }) return TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} })
end end
+13 -3
View File
@@ -1,10 +1,20 @@
if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "qs-smartphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "qs-smartphone"
Phone = {} local configValue = BridgeSharedConfig.Phone
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param src number
---@return number||boolean
Phone.GetPlayerPhone = function(src) Phone.GetPlayerPhone = function(src)
return exports['qs-base']:GetPlayerPhone(src) or false return exports['qs-base']:GetPlayerPhone(src) or false
end end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message) Phone.SendEmail = function(src, email, title, message)
TriggerClientEvent('community_bridge:Server:genericEmail', src, { sender = email, subject = title, message = message, button = {} }) TriggerClientEvent('community_bridge:Server:genericEmail', src, { sender = email, subject = title, message = message, button = {} })
return true return true
+10 -40
View File
@@ -1,44 +1,7 @@
-- if BridgeClientConfig.ProgressBar ~= "ox" then return end local resourceName = "ox_lib"
-- Progressbar = {} local configValue = BridgeClientConfig.ProgressBarSystem
-- local _progBarType = BridgeClientConfig.ProgressBarStyle or "bar" if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
-- Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
-- local runTime = time or 10000
-- local textLabel = label or "Doing something"
-- local deadBool = whiledead or false
-- local cancelBool = cancancel or false
-- local disableKeys = disable or { move = true, sprint = true, car = true, combat = true, }
-- local anim = animTable or nil
-- local success = successAction or function() Prints.Debug("Success") end
-- local canceled = canceledAction or function() Prints.Debug("Cancelled") end
-- if _progBarType == "bar" then
-- if exports.ox_lib:progressBar({
-- duration = runTime,
-- label = textLabel,
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- disable = disableKeys,
-- anim = anim,
-- }) then success() else canceled() end
-- elseif _progBarType == "circle" then
-- if exports.ox_lib:progressCircle({
-- duration = runTime,
-- label = textLabel,
-- position = 'bottom',
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- disable = disableKeys,
-- anim = anim,
-- }) then success() else canceled() end
-- end
-- end
-- Progressbar.IsProgressBarActive = function()
-- return exports.ox_lib:progressActive()
-- end
if GetResourceState('ox_lib') ~= 'started' or (BridgeClientConfig.ProgressBarSystem ~= "ox" and BridgeClientConfig.InputSystem ~= "auto") then return end
ProgressBar = ProgressBar or {} ProgressBar = ProgressBar or {}
local function convertFromQB(options) local function convertFromQB(options)
@@ -81,6 +44,11 @@ local function convertFromQB(options)
} }
end end
---comment
---@param options table
---@param cb any
---@param isQBInput boolean
---@return nil
function ProgressBar.Open(options, cb, isQBInput) function ProgressBar.Open(options, cb, isQBInput)
if isQBInput then if isQBInput then
options = convertFromQB(options) options = convertFromQB(options)
@@ -93,6 +61,7 @@ function ProgressBar.Open(options, cb, isQBInput)
return success return success
end end
--[[
RegisterCommand("progressbar", function() RegisterCommand("progressbar", function()
ProgressBar.Open({ ProgressBar.Open({
duration = 5000, duration = 5000,
@@ -109,3 +78,4 @@ RegisterCommand("progressbar", function()
print(cancelled and "Cancelled" or "Complete") print(cancelled and "Cancelled" or "Complete")
end) end)
end) end)
--]]
+10 -62
View File
@@ -1,66 +1,7 @@
-- if BridgeClientConfig.ProgressBar ~= "qb" then return end local resourceName = "progressbar"
-- Progressbar = {} local configValue = BridgeClientConfig.ProgressBarSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
-- local function convertOxToQB(disabledTable, animTable)
-- local repackedTable = { disabled = {}, animations = {}}
-- for _, v in pairs(disabledTable) do
-- if v.move then
-- repackedTable.disabled.disableMovement = v.move
-- end
-- if v.car then
-- repackedTable.disabled.disableCarMovement = v.car
-- end
-- if v.combat then
-- repackedTable.disabled.disableCombat = v.combat
-- end
-- if v.mouse then
-- repackedTable.disabled.disableMouse = v.mouse
-- end
-- end
-- for _, v in pairs(animTable) do
-- if v.dict then
-- repackedTable.animations.animDict = v.animDict
-- end
-- if v.clip then
-- repackedTable.animations.anim = v.anim
-- end
-- end
-- return repackedTable
-- end
-- Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
-- local runTime = time or 10000
-- local textLabel = label or "Doing something"
-- local deadBool = whiledead or false
-- local cancelBool = cancancel or false
-- local success = successAction or function() Prints.Debug("Success") end
-- local canceled = canceledAction or function() Prints.Debug("Cancelled") end
-- local repackedTable = convertOxToQB(disable, animTable)
-- exports['progressbar']:Progress({
-- name = textLabel,
-- duration = runTime,
-- label = textLabel,
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- controlDisables = repackedTable.disabled,
-- animation = repackedTable.animations,
-- prop = {},
-- propTwo = {}
-- }, function(cancelled)
-- if not cancelled then
-- success()
-- else
-- canceled()
-- end
-- end)
-- end
-- Progressbar.IsProgressBarActive = function()
-- return exports["progressbar"]:isDoingSomething()
-- end
if GetResourceState('progressbar') ~= 'started' or (BridgeClientConfig.ProgressBarSystem ~= "qb" and BridgeClientConfig.ProgressBarSystem ~= "auto") then return end
ProgressBar = ProgressBar or {} ProgressBar = ProgressBar or {}
local function convertFromOx(options) local function convertFromOx(options)
@@ -98,6 +39,11 @@ local function convertFromOx(options)
} }
end end
---comment
---@param options table
---@param cb any
---@param qbFormat boolean
---@return nil
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
@@ -110,6 +56,7 @@ end
-- Example usage: -- Example usage:
--[[
RegisterCommand("progressbar", function() RegisterCommand("progressbar", function()
ProgressBar.Open({ ProgressBar.Open({
duration = 5000, duration = 5000,
@@ -131,3 +78,4 @@ RegisterCommand("progressbar", function()
print(cancelled and "Cancelled" or "Complete") print(cancelled and "Cancelled" or "Complete")
end) end)
end) end)
--]]
+91
View File
@@ -0,0 +1,91 @@
Shops = Shops or {}
RegisterNetEvent('community_bridge:openShop', function(_type, _title, shopData)
if source ~= 65535 then return end
if not _title and not _title and not shopData then return end
if _type ~= 'shop' then return end
Shops.OpenShop(_title, shopData.inventory)
end)
Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price)
if not shopName and not item and not itemLabel and not price then return end
local generatedID = Ids.CreateUniqueId()
local buildMenu = {
{
title = locale('Shops.PayByCash')..tostring(price),
description = locale('Shops.AreYouSure') .. itemLabel,
icon = "fa-solid fa-money-bill-wave",
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, "cash")
end
},
{
title = locale('Shops.PayByCard')..tostring(price),
description = locale('Shops.AreYouSure') .. itemLabel,
icon = "fa-solid fa-building-column",
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, "bank")
end
}
}
Bridge.Menu.Open({ id = generatedID, title = locale("Shops.Confirm"), options = buildMenu }, false)
end
Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
if not shopName and not item and not itemLabel and not price then return end
local mathStuff = tonumber(price) * tonumber(amount)
local generatedID = Ids.CreateUniqueId()
local buildMenu = {
{
title = locale('Shops.PayByCash').." "..tostring(mathStuff),
description = locale('Shops.AreYouSure') .. itemLabel,
icon = "fa-solid fa-money-bill-wave",
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "money")
end
},
{
title = locale('Shops.PayByCard').." "..tostring(mathStuff),
description = locale('Shops.AreYouSure') .. itemLabel,
icon = "fa-solid fa-building-column",
onSelect = function(_, __, ___)
TriggerServerEvent('community_bridge:completeCheckout', shopName, item, amount, "bank")
end
}
}
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
end
Shops.AmountSelect = function(shopName, item, itemLabel, price)
if not shopName and not item and not itemLabel and not price then return end
local numberOptions = {}
for i = 1, 100 do
table.insert(numberOptions, {label = tostring(i), value = i})
end
local _input = Input.Open(shopName, {
{type = 'select', label = locale("Shops.PurchaseAmount"), options = numberOptions},
})
if _input and _input[1] then
Shops.FinalizeCheckOut(shopName, item, itemLabel, price, tostring(_input[1]))
end
end
Shops.OpenShop = function(title, shopData)
if not title and not shopData and not title then return print("No Title Passed") end
local generatedID = Ids.CreateUniqueId()
local buildMenu = {}
for _, v in pairs(shopData) do
local getItemName = Inventory.GetItemInfo(v.name).label
table.insert(buildMenu, {
title = getItemName,
description = locale('Shops.CurrencySymbol')..tostring(v.price),
icon = "fa-solid fa-basket-shopping",
onSelect = function(selected, secondary, args)
Shops.AmountSelect(title, v.name, getItemName, v.price)
--Shops.FinalizeCheckOut(title, v.name, getItemName, v.price)
end
})
end
Menu.Open({ id = generatedID, title = title, options = buildMenu }, false)
end
+46
View File
@@ -0,0 +1,46 @@
Shops = Shops or {}
local registeredShops = {}
Shops.OpenShop = function(src, shopTitle)
if not shopTitle and not registeredShops[shopTitle] then return false end
TriggerClientEvent('community_bridge:openShop', src, 'shop', shopTitle, registeredShops[shopTitle])
end
Shops.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle and not shopInventory and not shopCoords then return end
if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
return true
end
Shops.CompleteCheckout = function(src, shopName, item, amount, paymentType)
if not src and not shopName and not item and not amount and not paymentType then return end
local ilocale = Language.Locale
local shopData = registeredShops[shopName]
if not shopData then return end
local itemData = nil
for _, data in pairs(shopData.inventory) do
if data.name == item then
itemData = data
break
end
end
if not itemData then return print("Player ID "..src.." Is Possibly A Cheater And Has Attempted To Purchase A "..item) end
if not itemData.price then return end
local balance = Framework.GetAccountBalance(src, paymentType)
local mathStuff = tonumber(itemData.price) * tonumber(amount)
if balance < mathStuff then return Notify.SendNotify(src, ilocale('Shops.NotEnoughMoney'), "error", 5000) end
if not Framework.RemoveAccountBalance(src, paymentType, mathStuff) then return end
Inventory.AddItem(src, itemData.name, amount)
local itemLabel = Inventory.GetItemInfo(itemData.name).label
Notify.SendNotify(src, ilocale('Shops.PurchasedItem')..itemLabel, "success", 5000)
end
RegisterNetEvent("community_bridge:completeCheckout", function(shopName, item, amount, paymentType)
local src = source
if not shopName and not item and not paymentType then return end
if not paymentType == "money" or not paymentType == "bank" then return end
Shops.CompleteCheckout(src, shopName, item, amount, paymentType)
end)
+1 -1
View File
@@ -1,7 +1,7 @@
Target = Target or {} Target = Target or {}
local function warnUser() local function warnUser()
print("Currently Only Targeting Is Supported.") print("Currently Only Targeting Is Supported By Community Bridge, You Are Using A Resource That Requires The Target Module To Be Used.")
end end
Target.AddGlobalPlayer = function(options) Target.AddGlobalPlayer = function(options)
+37 -1
View File
@@ -1,4 +1,7 @@
if GetResourceState('ox_target') ~= 'started' then return end local resourceName = "ox_target"
local configValue = BridgeClientConfig.TargetSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
local targetDebug = false local targetDebug = false
local function detectDebugEnabled() local function detectDebugEnabled()
@@ -28,16 +31,25 @@ Target.FixOptions = function(options)
return options return options
end end
---comment
---@param options table
---@return nil
Target.AddGlobalPlayer = function(options) Target.AddGlobalPlayer = function(options)
options = Target.FixOptions(options) options = Target.FixOptions(options)
ox_target:addGlobalPlayer(options) ox_target:addGlobalPlayer(options)
end end
---comment
---@param options table
---@return nil
Target.AddGlobalVehicle = function(options) Target.AddGlobalVehicle = function(options)
options = Target.FixOptions(options) options = Target.FixOptions(options)
ox_target:addGlobalVehicle(options) ox_target:addGlobalVehicle(options)
end end
---comment
---@param options table
---@return nil
Target.RemoveGlobalVehicle = function(options) Target.RemoveGlobalVehicle = function(options)
local assembledLables = {} local assembledLables = {}
for k, v in pairs(options) do for k, v in pairs(options) do
@@ -46,16 +58,31 @@ Target.RemoveGlobalVehicle = function(options)
ox_target:removeGlobalVehicle(assembledLables) ox_target:removeGlobalVehicle(assembledLables)
end end
---comment
---@param entities table
---@param options table
---@return nil
Target.AddLocalEntity = function(entities, options) Target.AddLocalEntity = function(entities, options)
options = Target.FixOptions(options) options = Target.FixOptions(options)
ox_target:addLocalEntity(entities, options) ox_target:addLocalEntity(entities, options)
end end
---comment
---@param models table
---@param options table
---@return nil
Target.AddModel = function(models, options) Target.AddModel = function(models, options)
options = Target.FixOptions(options) options = Target.FixOptions(options)
ox_target:addModel(models, options) ox_target:addModel(models, options)
end end
---comment
---@param name string
---@param coords table
---@param size table
---@param heading number
---@param options table
---@return number
Target.AddBoxZone = function(name, coords, size, heading, options) Target.AddBoxZone = function(name, coords, size, heading, options)
options = Target.FixOptions(options) options = Target.FixOptions(options)
local target = ox_target:addBoxZone({ local target = ox_target:addBoxZone({
@@ -73,14 +100,23 @@ Target.RemoveGlobalPlayer = function()
ox_target:removeGlobalPlayer() ox_target:removeGlobalPlayer()
end end
---comment
---@param entity number
---@return nil
Target.RemoveLocalEntity = function(entity) Target.RemoveLocalEntity = function(entity)
ox_target:removeLocalEntity(entity) ox_target:removeLocalEntity(entity)
end end
---comment
---@param model string
---@return nil
Target.RemoveModel = function(model) Target.RemoveModel = function(model)
ox_target:removeModel(model) ox_target:removeModel(model)
end end
---comment
---@param name string
---@return nil
Target.RemoveZone = function(name) Target.RemoveZone = function(name)
for _, data in pairs(targetZones) do for _, data in pairs(targetZones) do
if data.name == name then if data.name == name then
+4 -1
View File
@@ -1,4 +1,7 @@
if GetResourceState('qb-target') ~= 'started' or GetResourceState('ox_target') == 'started' then return end local resourceName = "qb-target"
local configValue = BridgeClientConfig.TargetSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
if GetResourceState('ox_target') == 'started' then return end -- this is for older versions of ox that supported the backwards compatability. As its depricated we dont want to touch that.
local targetDebug = false local targetDebug = false
local function detectDebugEnabled() local function detectDebugEnabled()
+6 -1
View File
@@ -1,4 +1,9 @@
if GetResourceState('sleepless_interact') ~= 'started' then return end local resourceName = "sleepless_interact"
local configValue = BridgeClientConfig.TargetSystem
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
--if GetResourceState('sleepless_interact') ~= 'started' then return end
-- This is only partially supported
local sleepless = exports.sleepless_interact local sleepless = exports.sleepless_interact
@@ -1,10 +1,14 @@
if GetResourceState('F_RealCarKeysSystem') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "F_RealCarKeysSystem" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "F_RealCarKeysSystem"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate then return false end
TriggerServerEvent('F_RealCarKeysSystem:generateVehicleKeys', plate) TriggerServerEvent('F_RealCarKeysSystem:generateVehicleKeys', plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
return return true
end end
@@ -1,14 +1,15 @@
if GetResourceState('MrNewbVehicleKeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "MrNewbVehicleKeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "MrNewbVehicleKeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not DoesEntityExist(vehicle) and not plate then return false end if not plate then return false end
return exports.MrNewbVehicleKeys:GiveKeys(vehicle) return exports.MrNewbVehicleKeys:GiveKeysByPlate(plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if not vehicle and not plate then return false end if not plate then return false end
if not DoesEntityExist(vehicle) then return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate) end return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate)
return exports.MrNewbVehicleKeys:RemoveKeys(vehicle)
end end
@@ -1,21 +0,0 @@
if GetResourceState('MrNewbVehicleKeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "MrNewbVehicleKeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
if vehicle then
local netId = NetworkGetNetworkIdFromEntity(vehicle)
return exports.MrNewbVehicleKeys:GiveKeys(src, netId)
elseif plate then
return exports.MrNewbVehicleKeys:GiveKeysByPlate(src, plate)
end
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
if vehicle then
local netId = NetworkGetNetworkIdFromEntity(vehicle)
return exports.MrNewbVehicleKeys:RemoveKeys(src, netId)
elseif plate then
return exports.MrNewbVehicleKeys:RemoveKeysByPlate(src, plate)
end
end
@@ -1,13 +1,15 @@
if GetResourceState('Renewed-Vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "Renewed-Vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "Renewed-Vehiclekeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate and not DoesEntityExist(vehicle) then return false end if not plate then return false end
return exports['Renewed-Vehiclekeys']:addKey(plate) return exports['Renewed-Vehiclekeys']:addKey(plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if not plate and not DoesEntityExist(vehicle) then return false end if not plate then return false end
return exports['Renewed-Vehiclekeys']:removeKey(plate) return exports['Renewed-Vehiclekeys']:removeKey(plate)
end end
@@ -1,13 +0,0 @@
if GetResourceState('Renewed-Vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "Renewed-Vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
if not plate then plate = GetVehicleNumberPlateText(vehicle) end
exports['Renewed-Vehiclekeys']:addKey(src, plate)
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
if not plate then plate = GetVehicleNumberPlateText(vehicle) end
exports['Renewed-Vehiclekeys']:removeKey(src, plate)
end
@@ -1,9 +1,9 @@
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
-- wip return true, print("There Is No Vehicle Key System Installed")
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
-- wip return true, print("There Is No Vehicle Key System Installed")
end end
@@ -1,9 +0,0 @@
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
--wip
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
-- wip
end
@@ -1,10 +1,14 @@
if GetResourceState('cd_garage') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "cd_garage" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "cd_garage"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate then return false end
TriggerEvent('cd_garage:AddKeys', plate) TriggerEvent('cd_garage:AddKeys', plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
return true
end end
@@ -1,10 +0,0 @@
if GetResourceState('cd_garage') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "cd_garage" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
--wip
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
-- wip
end
+16
View File
@@ -0,0 +1,16 @@
local resourceName = "jaksams_VehiclesKeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate)
if not plate then return false end
return TriggerServerEvent("vehicles_keys:selfGiveVehicleKeys", plate)
end
VehicleKey.RemoveKeys = function(vehicle, plate)
if not plate then return false end
return TriggerServerEvent("vehicles_keys:selfRemoveKeys", plate)
end
@@ -1,13 +1,15 @@
if GetResourceState('mk_vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "mk_vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "mk_vehiclekeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not DoesEntityExist(vehicle) then return false end if not vehicle and not DoesEntityExist(vehicle) then return false end
return exports["mk_vehiclekeys"]:AddKey(vehicle) return exports["mk_vehiclekeys"]:AddKey(vehicle)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if not DoesEntityExist(vehicle) then return false end if not vehicle and not DoesEntityExist(vehicle) then return false end
return exports["mk_vehiclekeys"]:RemoveKey(vehicle) return exports["mk_vehiclekeys"]:RemoveKey(vehicle)
end end
@@ -1,11 +0,0 @@
if GetResourceState('mk_vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "mk_vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
-- wip
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
--wip
end
@@ -1,12 +1,14 @@
if GetResourceState('mono_carkeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "mono_carkeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "mono_carkeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if type(plate) ~= 'string' then return end if not plate then return false end
TriggerServerEvent('mono_carkeys:CreateKey', plate) TriggerServerEvent('mono_carkeys:CreateKey', plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if type(plate) ~= 'string' then return end if not plate then return false end
TriggerServerEvent('mono_carkeys:DeleteKey', 1, plate) TriggerServerEvent('mono_carkeys:DeleteKey', 1, plate)
end end
@@ -1,8 +1,11 @@
if GetResourceState('okokGarage') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "okokGarage" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "okokGarage"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate then return false end
TriggerServerEvent('okokGarage:GiveKeys', plate) TriggerServerEvent('okokGarage:GiveKeys', plate)
end end
@@ -1,11 +0,0 @@
if GetResourceState('okokGarage') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "okokGarage" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
--wip
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
-- wip
end
@@ -1,12 +1,15 @@
if GetResourceState('qb-vehiclekeys') ~= 'started' and not GetResourceState("qbx_vehiclekeys") == "started" or (BridgeSharedConfig.VehicleKey ~= "qb-vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "qb-vehiclekeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end if not plate then return false end
TriggerServerEvent("qb-vehiclekeys:server:AcquireVehicleKeys", plate) TriggerServerEvent("qb-vehiclekeys:server:AcquireVehicleKeys", plate)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end if not plate then return false end
TriggerEvent("qb-vehiclekeys:client:RemoveKeys", plate) TriggerEvent("qb-vehiclekeys:client:RemoveKeys", plate)
end end
@@ -1,17 +0,0 @@
if GetResourceState('qb-vehiclekeys') ~= 'started' and not GetResourceState("qbx_vehiclekeys") == "started" or (BridgeSharedConfig.VehicleKey ~= "qb-vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
if not plate and vehicle then
plate = GetVehicleNumberPlateText(vehicle)
end
return exports["qb-vehiclekeys"]:GiveKeys(src, plate)
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
if not plate and vehicle then
plate = GetVehicleNumberPlateText(vehicle)
end
return exports["qb-vehiclekeys"]:RemoveKeys(src, plate)
end
@@ -1,9 +1,11 @@
if GetResourceState('qbx_vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "qbx_vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "qbx_vehiclekeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end if not plate then return false end
TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate) TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
end end
@@ -1,11 +0,0 @@
if GetResourceState('qbx_vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "qbx_vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
--wip
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
-- wip
end
@@ -1,29 +1,19 @@
if GetResourceState('qs-vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "qs-vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "qs-vehiclekeys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
if not vehicle then return end if not vehicle then return false end
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
local verifiedPlate = GetVehicleNumberPlateText(vehicle) local verifiedPlate = GetVehicleNumberPlateText(vehicle)
return exports['qs-vehiclekeys']:GiveKeys(verifiedPlate, model, true) return exports['qs-vehiclekeys']:GiveKeys(verifiedPlate, model, true)
end end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
if not vehicle then return end if not vehicle then return false end
local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))
local verifiedPlate = GetVehicleNumberPlateText(vehicle) local verifiedPlate = GetVehicleNumberPlateText(vehicle)
return exports['qs-vehiclekeys']:RemoveKeys(verifiedPlate, model) return exports['qs-vehiclekeys']:RemoveKeys(verifiedPlate, model)
end end
RegisterNetEvent("community_bridge:vehicleKey:removeKeys", function(netId, plate)
if not NetworkDoesNetworkIdExist(netId) then return end
local vehicle = NetworkGetEntityFromNetworkId(netId)
VehicleKey.RemoveKeys(vehicle, plate)
end)
RegisterNetEvent("community_bridge:vehicleKey:giveKeys", function(netId, plate)
if not NetworkDoesNetworkIdExist(netId) then return end
local vehicle = NetworkGetEntityFromNetworkId(netId)
VehicleKey.GiveKeys(vehicle, plate)
end)
@@ -1,15 +0,0 @@
if GetResourceState('qs-vehiclekeys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "qs-vehiclekeys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
if not vehicle and not plate then return end
local netId = NetworkGetNetworkIdFromEntity(vehicle)
TriggerClientEvent("community_bridge:vehicleKey:giveKeys", src, netId, plate)
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
if not vehicle and not plate then return end
local netId = NetworkGetNetworkIdFromEntity(vehicle)
TriggerClientEvent("community_bridge:vehicleKey:removeKeys", src, netId, plate)
end
@@ -1,4 +1,6 @@
if GetResourceState('t1ger_keys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "t1ger_keys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "t1ger_keys"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
@@ -11,7 +13,3 @@ end
VehicleKey.RemoveKeys = function(vehicle, plate) VehicleKey.RemoveKeys = function(vehicle, plate)
end end
RegisterNetEvent("community_bridge:vehicleKey:giveKeys", function(plate)
VehicleKey.GiveKeys(nil, plate)
end)
@@ -1,11 +0,0 @@
if GetResourceState('t1ger_keys') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "t1ger_keys" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
TriggerClientEvent("community_bridge:vehicleKey:giveKeys", src, plate)
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
end
@@ -1,4 +1,7 @@
if GetResourceState('wasabi_carlock') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "wasabi_carlock" and BridgeSharedConfig.VehicleKey ~= "auto") then return end local resourceName = "wasabi_carlock"
local configValue = BridgeClientConfig.VehicleKey
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
VehicleKey = VehicleKey or {} VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(vehicle, plate) VehicleKey.GiveKeys = function(vehicle, plate)
@@ -1,12 +0,0 @@
if GetResourceState('wasabi_carlock') ~= 'started' or (BridgeSharedConfig.VehicleKey ~= "wasabi_carlock" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
VehicleKey = VehicleKey or {}
VehicleKey.GiveKeys = function(src, vehicle, plate)
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end
exports.wasabi_carlock:GiveKey(src, plate)
end
VehicleKey.RemoveKeys = function(src, vehicle, plate)
if not plate and vehicle then plate = GetVehicleNumberPlateText(vehicle) end
exports.wasabi_carlock:RemoveKey(src, plate)
end
+12 -1
View File
@@ -1,6 +1,16 @@
Version = Version or {} Version = Version or {}
function Version.VersionChecker(repoPath) ---Pass a github username and repo name to check for the latest version of the resource.
---
---
---Tebex is a optional boolean to determine if the message should be for a escrowed resource or not.
---
---
---Example Version.VersionChecker("The-Order-Of-The-Sacred-Framework/community_bridge")
---@param repoPath string
---@param tebex boolean | nil
---@return nil
function Version.VersionChecker(repoPath, tebex)
local resource = repoPath:match("([^/]+)$") local resource = repoPath:match("([^/]+)$")
if not resource then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end if not resource then return Prints.Error('^1Invalid repository format. Expected format: "username/reponame"^0') end
@@ -28,6 +38,7 @@ function Version.VersionChecker(repoPath)
local currentVersion, latestVersion = version:gsub('%D', ''), latest:gsub('%D', '') local currentVersion, latestVersion = version:gsub('%D', ''), latest:gsub('%D', '')
if currentVersion < latestVersion then if currentVersion < latestVersion then
if tebex then return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the portal/keymaster.^7\r\n%s'):format(resource, version, "https://portal.cfx.re/assets/granted-assets")) end
return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the GitHub release page.^7\r\n%s'):format(resource, version, response.html_url)) return print(('^1An update is available for %s (current version: %s)\r\n - ^5Please download the latest version from the GitHub release page.^7\r\n%s'):format(resource, version, response.html_url))
end end
end, 'GET') end, 'GET')
@@ -1,6 +1,8 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {} Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
if toggle then if toggle then
TriggerEvent("qb-weathersync:client:EnableSync") TriggerEvent("qb-weathersync:client:EnableSync")
@@ -1,6 +0,0 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {}
Weather.ToggleSync = function(src, toggle)
-- wip
end
@@ -1,6 +1,8 @@
if GetResourceState('Renewed-Weathersync') ~= 'started' then return end if GetResourceState('Renewed-Weathersync') ~= 'started' then return end
Weather = {} Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
LocalPlayer.state.syncWeather = toggle LocalPlayer.state.syncWeather = toggle
end end
@@ -1,6 +0,0 @@
if GetResourceState('Renewed-Weathersync') ~= 'started' then return end
Weather = {}
Weather.ToggleSync = function(src, toggle)
-- wip
end
+2
View File
@@ -1,6 +1,8 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {} Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle) Weather.ToggleSync = function(toggle)
if toggle then if toggle then
TriggerEvent("qb-weathersync:client:EnableSync") TriggerEvent("qb-weathersync:client:EnableSync")
-6
View File
@@ -1,6 +0,0 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {}
Weather.ToggleSync = function(src, toggle)
-- wip
end
+10 -9
View File
@@ -1,12 +1,13 @@
BridgeClientConfig = {} BridgeClientConfig = {}
BridgeClientConfig.DebugLevel = 0 -- Debug level, 0 for none, 1 for some, 2 for all data BridgeClientConfig.DebugLevel = 0 -- Debug level, 0 for none, 1 for some, 2 for all data
BridgeClientConfig.NotifySystem = "ox" -- [ ox | qb | esx | mythic | pNotify | t-notify | wasabi | lab | custom ] BridgeClientConfig.NotifySystem = "ox" -- [ ox | qb | esx | mythic | pNotify | t-notify | wasabi | lab | custom ]
BridgeClientConfig.HelpTextSystem = "auto" BridgeClientConfig.ShowHelpText = "ox" -- [ ox | qb | jg | okok | cd | lab | custom ]
BridgeClientConfig.ShowHelpText = "ox" -- [ox | jg | qb | lab | custom ] BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ]
BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ] BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | qb-menu ]
BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox | qb ] BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | progressbar ]
BridgeClientConfig.ProgressBarSystem = "auto" BridgeClientConfig.ZoneSystem = "ox" -- [ ox | poly ]
BridgeClientConfig.ZoneSystem = "ox" -- [ ox | poly ] BridgeClientConfig.VehicleKey = "auto" -- [ auto | qb-vehiclekeys | MrNewbVehicleKeys | jaksams_VehiclesKeys | wasabi_carlock | mk_vehiclekeys | qbx_vehiclekeys | qs-vehiclekeys | t1ger_keys | Renewed-Vehiclekeys | mono_carkeys| cd_garage | okokGarage | F_RealCarKeysSystem
BridgeClientConfig.ProgressBar = "ox" -- [ ox | qb ] BridgeClientConfig.Fuel = "auto" -- [ auto | LegacyFuel | ox_fuel | ps-fuel | qs-fuelstations | Renewed-Fuel | ti_fuel | lc_fuel | x-fuel | cdn-fuel | esx-sna-fuel | BigDaddy-Fuel | okokGasStation ]
BridgeClientConfig.TargetSystem = "auto" -- [ auto | ox_target | qb-target | sleepless_interact ] -- sleepless is only partially supported and would need another system in place
return BridgeClientConfig return BridgeClientConfig
+2 -2
View File
@@ -1,6 +1,6 @@
BridgeServerConfig = {} BridgeServerConfig = {}
BridgeServerConfig.LogSystem = "builtin" -- [ builtin | qb | ox ] BridgeServerConfig.LogSystem = "ox" -- [ builtin | qb | ox ]
BridgeServerConfig.WebhookURL = "PUT_WEBHOOK_URL_HERE" BridgeServerConfig.WebhookURL = "PUT_WEBHOOK_URL_HERE" -- only if using builtin
BridgeServerConfig.WebhookImage = "https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024" BridgeServerConfig.WebhookImage = "https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024"
BridgeServerConfig.MaxInventorySlots = 50 BridgeServerConfig.MaxInventorySlots = 50
+1 -2
View File
@@ -1,7 +1,6 @@
BridgeSharedConfig = {} BridgeSharedConfig = {}
BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc) BridgeSharedConfig.Lang = "auto" -- Change this to your preferred language (must match the locale file name ex. en or fr etc)
BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data BridgeSharedConfig.DebugLevel = 0 -- Change this to your Debug level, 0 for none, 1 for some, 2 for all data
BridgeSharedConfig.VehicleKey = "auto" -- Change this to your prefrence or leave it as auto BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone]
BridgeSharedConfig.Phone = "auto" -- Change this to your prefrence or leave it as auto
return BridgeSharedConfig return BridgeSharedConfig