diff --git a/fxmanifest.lua b/fxmanifest.lua index 3409f07..8c28da5 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -4,7 +4,7 @@ lua54 'yes' use_experimental_fxv2_oal 'yes' 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.' -version '0.3.13' +version '0.4.0' shared_scripts { '@ox_lib/init.lua', @@ -26,8 +26,7 @@ server_scripts { 'modules/managment/**/server.lua', 'modules/dispatch/**/server.lua', 'modules/clothing/**/server.lua', - 'modules/weather/**/server.lua', - 'modules/vehicleKey/**/server.lua', + 'modules/shops/**/server.lua', 'modules/notify/**/server.lua', 'init.lua', } @@ -50,6 +49,7 @@ client_scripts { 'modules/menu/*.lua', 'modules/notify/**/client.lua', 'modules/dialogue/**/client/*.lua', + 'modules/shops/**/client.lua', 'init.lua', } diff --git a/init.lua b/init.lua index e3eea58..fc9ec63 100644 --- a/init.lua +++ b/init.lua @@ -52,8 +52,8 @@ Bridge.RegisterModule("Language", Language) Bridge.RegisterModule("Doorlock", Doorlock) Bridge.RegisterModule("Phone", Phone) Bridge.RegisterModule("Dispatch", Dispatch) -Bridge.RegisterModule("VehicleKey", VehicleKey) -Bridge.RegisterModule("Weather", Weather) +Bridge.RegisterModule("Shops", Shops) + --lib Bridge.RegisterModule("Tables", cLib.Tables) Bridge.RegisterModule("Math", cLib.Math) @@ -92,6 +92,8 @@ if IsDuplicityVersion() then return end Bridge.RegisterModule("Fuel", Fuel) Bridge.RegisterModule("Input", Input) Bridge.RegisterModule("ProgressBar", ProgressBar) +Bridge.RegisterModule("VehicleKey", VehicleKey) +Bridge.RegisterModule("Weather", Weather) Bridge.RegisterModule("Target", Target) Bridge.RegisterModule("Menu", Menu) diff --git a/lib/client/utility.lua b/lib/client/utility.lua index 63d6fb3..d023f07 100644 --- a/lib/client/utility.lua +++ b/lib/client/utility.lua @@ -4,7 +4,6 @@ local spawnedPeds = {} local ActivePoints = {} Utility.CreateProp = function(model, coords, heading, networked) - if networked == nil then networked = true end Utility.LoadModel(model) 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) @@ -14,30 +13,20 @@ Utility.CreateProp = function(model, coords, heading, networked) end Utility.CreateVehicle = function(model, coords, heading, networked) - if networked == nil then networked = true end Utility.LoadModel(model) 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) SetVehicleHasBeenOwnedByPlayer(vehicle, true) SetVehicleNeedsToBeHotwired(vehicle, false) - SetModelAsNoLongerNeeded(model) SetVehRadioStation(vehicle, "OFF") + SetModelAsNoLongerNeeded(model) return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), } end -Utility.CreatePed = function(model, coords, heading, networked, clothing) - if networked == nil then networked = true end +Utility.CreatePed = function(model, coords, heading, networked, settings) Utility.LoadModel(model) 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) - 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) table.insert(spawnedPeds, spawnedEntity) return spawnedEntity @@ -48,17 +37,23 @@ Utility.StartBusySpinner = function(text) BeginTextCommandBusyString(text) AddTextComponentSubstringPlayerName(text) EndTextCommandBusyString(0) + return true end Utility.StopBusySpinner = function() - if BusyspinnerIsOn() then BusyspinnerOff() end + if BusyspinnerIsOn() then + BusyspinnerOff() + return true + end + return false 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) SetBlipSprite(blip, sprite or 8) SetBlipColour(blip, color or 3) SetBlipScale(blip, scale or 0.8) + SetBlipDisplay(blip, displayType or 2) SetBlipAsShortRange(blip, shortRange) AddTextEntry(label, label) BeginTextCommandSetBlipName(label) @@ -71,7 +66,7 @@ Utility.RemoveBlip = function(blip) local success = false for i, storedBlip in ipairs(blipIDs) do if storedBlip == blip then - RemoveBlip(blip) + RemoveBlip(storedBlip) table.remove(blipIDs, i) success = true break @@ -104,7 +99,9 @@ end Utility.RemovePed = function(entity) local success = false - DeleteEntity(entity) + if DoesEntityExist(entity) then + DeleteEntity(entity) + end for i, storedEntity in ipairs(spawnedPeds) do if storedEntity == entity then table.remove(spawnedPeds, i) @@ -230,51 +227,58 @@ Utility.GetClosestPlayer = function(coords, distanceScope, includeMe) return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer) end --- register points -Utility.RegisterPoint = function(pointCoords, pointDistance, pointOnEnter, pointOnExit) - local enterZone = lib.points.new({ - coords = pointCoords, +---This function is used to register a point on the map, functions are fired when in the distance/exiting the area +---@param pointID string +---@param pointCoords table +---@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, - onEnter = function(self) - pointOnEnter(self) + onEnter = function(self) + _onEnter(self) end, - onExit = function(self) - pointOnExit(self) + onExit = function(self) + _onExit(self) end, + nearby = function(self) + _nearby(self) + end }) - local pointID = Bridge.Ids.RandomLower(nil, 8) - ActivePoints[pointID] = enterZone - return enterZone, pointID end --- Function to retrieve the enterZone using pointID +-- Function to retrieve the zone by the pointID +---@param pointID string Utility.GetPointById = function(pointID) return ActivePoints[pointID] 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) - local point = ActivePoints[pointID] - if point then - --print("Removing point with ID " .. pointID) - point:remove() -- Call the remove method on the point (ensure this method stops all event listeners) - ActivePoints[pointID] = nil -- Remove from ActivePoints table - --print("Point removed successfully.") - return true - else - --print("Point with ID " .. pointID .. " not found.") - return false - end + if not ActivePoints[pointID] then return false end + ActivePoints[pointID]:remove() + ActivePoints[pointID] = nil + return true end AddEventHandler('onResourceStop', function(resource) if resource == GetCurrentResourceName() then for _, blip in pairs(blipIDs) do - if DoesBlipExist(blip.id) then - RemoveBlip(blip.id) + if blip and DoesBlipExist(blip) then + RemoveBlip(blip) end end for _, ped in pairs(spawnedPeds) do - if DoesEntityExist(ped) then + if ped and DoesEntityExist(ped) then DeleteEntity(ped) end end diff --git a/lib/shared/callbacks.lua b/lib/shared/callbacks.lua index 02d27c5..88a228a 100644 --- a/lib/shared/callbacks.lua +++ b/lib/shared/callbacks.lua @@ -106,13 +106,7 @@ function Callback.Trigger(name, func, ...) local p = promise.new() TriggerServerEvent(clientToServerName, name, ...) 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) end diff --git a/locales/en.json b/locales/en.json index 643f796..6b04803 100644 --- a/locales/en.json +++ b/locales/en.json @@ -6,6 +6,7 @@ "place_object_scroll_down": "[SCROLL DOWN] Turn left", "enter_text": "Enter Text", "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": { "UNITTESTA": "Im a %s %s", "UNITTEST": { diff --git a/modules/dialogue/default/client/client.lua b/modules/dialogue/default/client/client.lua index 7b3deed..c00ed6d 100644 --- a/modules/dialogue/default/client/client.lua +++ b/modules/dialogue/default/client/client.lua @@ -10,7 +10,7 @@ function Dialogue.Close(name) -- Instead of destroying immediately, wait to see if new dialogue opens pendingCameraDestroy = true activeDialogue = nil - + SetNuiFocus(false, false) SendNUIMessage({ type = "close", @@ -28,7 +28,7 @@ function Dialogue.Close(name) cam = nil end end) - + promises[name] = nil end @@ -50,17 +50,17 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel pendingCameraDestroy = false activeDialogue = name - -- camera magic! - if entity then + -- camera magic! + if entity then local pedHeading = GetEntityHeading(entity) -- Convert heading to radians and calculate offset local angleRad = math.rad(pedHeading) local offsetX = math.sin(angleRad) * 1.5 local offsetY = math.cos(angleRad) * 1.5 - + -- Get position in front of ped based on their heading local endLocation = GetEntityCoords(entity) + vector3(offsetX, offsetY, 0.5) + offset - + if not cam then cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1) end local camPos = GetCamCoord(cam) local dist = #(endLocation - camPos) @@ -71,7 +71,7 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel SetCamCoord(cam, endLocation.x, endLocation.y, endLocation.z) RenderScriptCams(true, true, 1000, true, false) SetCamActive(cam, true) - end + end end SendNUIMessage({ type = "open", @@ -80,10 +80,10 @@ function Dialogue.Open( name, dialogue, characterOptions, dialogueOptions, onSel options = dialogueOptions }) SetNuiFocus(true, true) - + local prom = promise.new() - local wrappedFunction = function(selected) + local wrappedFunction = function(selected) SetNuiFocus(false, false) Dialogue.Close(name) if onSelected then onSelected(selected) end @@ -101,7 +101,7 @@ RegisterNuiCallback("dialogue:SelectOption", function(data) end) -- Debug command -if BridgeSharedConfig.DebugLevel >= 1 then +if BridgeSharedConfig.DebugLevel >= 1 then RegisterCommand("dialogue", function() local pos = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0, 2.0, 0) local timeout = 500 @@ -123,7 +123,7 @@ if BridgeSharedConfig.DebugLevel >= 1 then rotationOffset = vector3(0, 0, 0) } Wait(750) - Dialogue.Open("Akmed", "Hello how are you doing my friend?", characterData, { + Dialogue.Open("Akmed", "Hello how are you doing my friend?", characterData, { { label = "Trade with me", id = 'something', @@ -135,10 +135,10 @@ if BridgeSharedConfig.DebugLevel >= 1 then }, function(selectedId) if selectedId == 'something' then - Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, { + Dialogue.Open( "Akmed" , "Thank you for wanting to purchase me lucky charms", characterData, { { label = "Fuck off", - id = 'something', + id = 'something', }, { label = "Goodbye", @@ -147,7 +147,7 @@ if BridgeSharedConfig.DebugLevel >= 1 then }, function(selectedId) DeleteEntity(ped) - if selectedId == "something" then + if selectedId == "something" then print("You hate lucky charms") else print("Thanks for keeping it civil") diff --git a/modules/framework/es_extended/client.lua b/modules/framework/es_extended/client.lua index e905e97..9b6dd40 100644 --- a/modules/framework/es_extended/client.lua +++ b/modules/framework/es_extended/client.lua @@ -8,10 +8,14 @@ Framework.GetFrameworkName = function() return 'es_extended' end +---comment +---@return table Framework.GetPlayerData = function() return ESX.PlayerData end +---comment +---@return string Framework.GetPlayerDob = function() local playerData = ESX.GetPlayerData() local dob = playerData.dateofbirth @@ -22,35 +26,57 @@ Framework.GetPlayerMetaData = function(metadata) return ESX.GetPlayerData().metadata[metadata] end +---comment +---@param message string +---@param type string +---@param time number +---@return nil Framework.Notify = function(message, type, time) return ESX.ShowNotification(message, type, time) end +---comment +---@return string Framework.GetPlayerIdentifier = function() local playerData = ESX.GetPlayerData() return playerData.identifier end +---comment +---@return string +---@return string Framework.GetPlayerName = function() local playerData = ESX.GetPlayerData() return playerData.firstName, playerData.lastName end +---comment +---@return string +---@return string +---@return string +---@return string Framework.GetPlayerJob = function() local playerData = ESX.GetPlayerData() return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade end +---comment +---@param item string +---@return boolean Framework.HasItem = function(item) local hasItem = ESX.SearchInventory(item, true) return hasItem > 0 and true or false end +---comment +---@return table Framework.GetPlayerInventory = function() local playerData = ESX.GetPlayerData() return playerData.inventory end +---comment +---@return boolean Framework.GetIsPlayerDead = function() local playerData = ESX.GetPlayerData() return playerData.dead diff --git a/modules/framework/es_extended/server.lua b/modules/framework/es_extended/server.lua index 4496eee..08b8dc9 100644 --- a/modules/framework/es_extended/server.lua +++ b/modules/framework/es_extended/server.lua @@ -10,6 +10,7 @@ end Framework.GetPlayerDob = function(src) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end local dob = xPlayer.get("dateofbirth") return dob end @@ -18,6 +19,7 @@ end -- Returns the citizen ID of the player. Framework.GetPlayerIdentifier = function(src) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.getIdentifier() end @@ -25,6 +27,7 @@ end -- Returns the first and last name of the player. Framework.GetPlayerName = function(src) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.variables.firstName, xPlayer.variables.lastName 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 {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} 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 = {} for _, v in pairs(playerItems) do 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. Framework.GetItemCount = function(src, item, _) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.getInventoryItem(item).count 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) -- Returns the entire inventory of the player as a table. -- returns {name = v.name, count = v.amount, _, _} 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 = {} for _, v in pairs(playerItems) do if v.count > 0 then @@ -77,6 +94,7 @@ end -- Adds the specified metadata key and number value to the player's data. Framework.SetPlayerMetadata = function(src, metadata, value) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end xPlayer.setMeta(metadata, value, nil) return true end @@ -85,6 +103,7 @@ end -- Gets the specified metadata key and value to the player's data. Framework.GetPlayerMetadata = function(src, metadata) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.getMeta(metadata) or false end @@ -95,6 +114,7 @@ end -- phone_number, pincode Framework.GetStatus = function(src, column) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.get(column) or nil end @@ -132,6 +152,7 @@ end -- Returns the phone number of the player. Framework.GetPlayerPhone = function(src) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.get("phone_number") end @@ -139,6 +160,7 @@ end -- Returns the job name, label, grade name, and grade level of the player. Framework.GetPlayerJob = function(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 end @@ -160,12 +182,14 @@ end -- Sets the player's job to the specified name and grade. Framework.SetPlayerJob = function(src, name, grade) 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 return xPlayer.setJob(name, grade, true) end Framework.ToggleDuty = function(src, status) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end local name = xPlayer.getJob().name local grade = xPlayer.getJob().grade xPlayer.setJob(name, grade, status) @@ -175,6 +199,7 @@ end -- Adds the specified amount to the player's account balance of the specified type. Framework.AddAccountBalance = function(src, _type, amount) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.addAccountMoney(_type, amount) end @@ -182,6 +207,7 @@ end -- Removes the specified amount from the player's account balance of the specified type. Framework.RemoveAccountBalance = function(src, _type, amount) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.removeAccountMoney(_type, amount) end @@ -189,6 +215,7 @@ end -- Returns the player's account balance of the specified type. Framework.GetAccountBalance = function(src, _type) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.getAccount(_type).money end @@ -196,6 +223,7 @@ end -- Adds the specified item to the player's inventory. Framework.AddItem = function(src, item, amount, slot, metadata) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.addInventoryItem(item, amount) end @@ -203,6 +231,7 @@ end -- Removes the specified item from the player's inventory. Framework.RemoveItem = function(src, item, amount, slot, metadata) local xPlayer = ESX.GetPlayerFromId(src) + if not xPlayer then return end return xPlayer.removeInventoryItem(item, amount) end diff --git a/modules/framework/qb-core/server.lua b/modules/framework/qb-core/server.lua index 6ea0e5d..39629b5 100644 --- a/modules/framework/qb-core/server.lua +++ b/modules/framework/qb-core/server.lua @@ -13,6 +13,7 @@ end -- Returns the citizen ID of the player. Framework.GetPlayerIdentifier = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.citizenid end @@ -21,12 +22,14 @@ end -- Returns the first and last name of the player. Framework.GetPlayerName = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.charinfo.firstname, playerData.charinfo.lastname end Framework.GetPlayerDob = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.charinfo.birthdate end @@ -36,6 +39,7 @@ end -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} Framework.GetItem = function(src, item, metadata) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local playerInventory = playerData.items 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. Framework.GetItemCount = function(src, item, metadata) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local playerInventory = playerData.items local count = 0 @@ -67,11 +72,21 @@ Framework.GetItemCount = function(src, item, metadata) return count 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) -- Returns the entire inventory of the player as a table. -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} Framework.GetPlayerInventory = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local playerInventory = playerData.items local repackedTable = {} @@ -88,6 +103,7 @@ end Framework.GetItemBySlot = function(src, slot) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local playerInventory = playerData.items local repack = {} @@ -112,6 +128,7 @@ end -- Adds the specified metadata key and number value to the player's data. Framework.SetPlayerMetadata = function(src, metadata, value) local player = QBCore.Functions.GetPlayer(src) + if not player then return end player.Functions.SetMetaData(metadata, value) return true end @@ -120,6 +137,7 @@ end -- Gets the specified metadata key to the player's data. Framework.GetPlayerMetadata = function(src, metadata) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.metadata[metadata] or false end @@ -128,6 +146,7 @@ end -- Adds the specified value to the player's stress level and updates the client HUD. Framework.AddStress = function(src, value) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newStress = playerData.metadata.stress + value 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. Framework.RemoveStress = function(src, value) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newStress = (playerData.metadata.stress or 0) - value player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) @@ -150,6 +170,7 @@ end -- Adds the specified value from the player's hunger level. Framework.AddHunger = function(src, value) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newHunger = (playerData.metadata.hunger or 0) + value player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100)) @@ -161,6 +182,7 @@ end -- Adds the specified value from the player's thirst level. Framework.AddThirst = function(src, value) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newThirst = (playerData.metadata.thirst or 0) + value player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100)) @@ -170,6 +192,7 @@ end Framework.GetHunger = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newHunger = (playerData.metadata.hunger or 0) return newHunger @@ -177,6 +200,7 @@ end Framework.GetThirst = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newThirst = (playerData.metadata.thirst or 0) return newThirst @@ -186,6 +210,7 @@ end -- Returns the phone number of the player. Framework.GetPlayerPhone = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.charinfo.phone end @@ -194,6 +219,7 @@ end -- Returns the gang name of the player. Framework.GetPlayerGang = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.gang.name end @@ -216,6 +242,7 @@ end -- Returns the job name, label, grade name, and grade level of the player. Framework.GetPlayerJob = function(src) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.job.name, playerData.job.label, playerData.job.grade.name, playerData.job.grade.level end @@ -224,11 +251,13 @@ end -- Sets the player's job to the specified name and grade. Framework.SetPlayerJob = function(src, name, grade) local player = QBCore.Functions.GetPlayer(src) + if not player then return end return player.Functions.SetJob(name, grade) end Framework.ToggleDuty = function(src, status) local player = QBCore.Functions.GetPlayer(src) + if not player then return end player.Functions.SetJobDuty(status) TriggerEvent('QBCore:Server:SetDuty', src, player.PlayerData.job.onduty) end @@ -237,6 +266,7 @@ end -- Adds the specified amount to the player's account balance of the specified type. Framework.AddAccountBalance = function(src, _type, amount) local player = QBCore.Functions.GetPlayer(src) + if not player then return end if _type == 'money' then _type = 'cash' end return player.Functions.AddMoney(_type, amount) end @@ -245,6 +275,7 @@ end -- Removes the specified amount from the player's account balance of the specified type. Framework.RemoveAccountBalance = function(src, _type, amount) local player = QBCore.Functions.GetPlayer(src) + if not player then return end if _type == 'money' then _type = 'cash' end return player.Functions.RemoveMoney(_type, amount) end @@ -252,7 +283,9 @@ end -- Framework.GetAccountBalance(src, _type) -- Returns the player's account balance of the specified 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 return playerData.money[_type] end @@ -261,6 +294,7 @@ end -- Adds the specified item to the player's inventory. Framework.AddItem = function(src, item, amount, slot, metadata) 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}) return player.Functions.AddItem(item, amount, slot, metadata) end @@ -269,6 +303,7 @@ end -- Removes the specified item from the player's inventory. Framework.RemoveItem = function(src, item, amount, slot, metadata) 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}) return player.Functions.RemoveItem(item, amount, slot or nil) 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 Framework.SetMetadata = function(src, item, slot, metadata) local player = QBCore.Functions.GetPlayer(src) + if not player then return end local slotFinder = Framework.GetPlayerInventory(src) local freeSlot = Table.FindFirstUnoccupiedSlot(slotFinder) local itemSlot = slot or nil diff --git a/modules/framework/qbx_core/server.lua b/modules/framework/qbx_core/server.lua index 7790468..8d62d13 100644 --- a/modules/framework/qbx_core/server.lua +++ b/modules/framework/qbx_core/server.lua @@ -9,14 +9,18 @@ Framework.GetFrameworkName = function() end 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 end -- Framework.GetPlayerIdentifier(src) -- Returns the citizen ID of the player. 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 return playerData.citizenid end @@ -24,7 +28,9 @@ end -- Framework.GetPlayerName(src) -- Returns the first and last name of the player. 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 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 {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} 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 = {} for _, v in pairs(playerInventory) do if v.name == item and (not metadata or v.info == metadata) then @@ -50,7 +58,9 @@ end -- Framework.GetItemCount(src, item, metadata) -- Returns the count of items matching the specified name and if passed metadata from the player's inventory. 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 for _, v in pairs(playerInventory) do if v.name == item and (not metadata or v.info == metadata) then @@ -60,11 +70,22 @@ Framework.GetItemCount = function(src, item, metadata) return count 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) -- Returns the entire inventory of the player as a table. -- returns {name = v.name, count = v.amount, metadata = v.info, slot = v.slot} 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 = {} for _, v in pairs(playerItems) do table.insert(repackedTable, { @@ -81,6 +102,7 @@ end -- Adds the specified metadata key and number value to the player's data. Framework.SetPlayerMetadata = function(src, metadata, value) local player = QBox:GetPlayer(src) + if not player then return end player.Functions.SetMetaData(metadata, value) return true end @@ -89,6 +111,7 @@ end -- Gets the specified metadata key to the player's data. Framework.GetPlayerMetadata = function(src, metadata) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData return playerData.metadata[metadata] or false end @@ -97,6 +120,7 @@ end -- Adds the specified value to the player's stress level and updates the client HUD. Framework.AddStress = function(src, value) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newStress = playerData.metadata.stress + value 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. Framework.RemoveStress = function(src, value) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newStress = (playerData.metadata.stress or 0) - value player.Functions.SetMetaData('stress', Math.Clamp(newStress, 0, 100)) @@ -119,6 +144,7 @@ end -- Adds the specified value from the player's hunger level. Framework.AddHunger = function(src, value) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newHunger = (playerData.metadata.hunger or 0) + value player.Functions.SetMetaData('hunger', Math.Clamp(newHunger, 0, 100)) @@ -130,6 +156,7 @@ end -- Adds the specified value from the player's thirst level. Framework.AddThirst = function(src, value) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newThirst = (playerData.metadata.thirst or 0) + value player.Functions.SetMetaData('thirst', Math.Clamp(newThirst, 0, 100)) @@ -139,6 +166,7 @@ end Framework.GetHunger = function(src) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newHunger = (playerData.metadata.hunger or 0) return newHunger @@ -146,6 +174,7 @@ end Framework.GetThirst = function(src) local player = QBox:GetPlayer(src) + if not player then return end local playerData = player.PlayerData local newThirst = (playerData.metadata.thirst or 0) return newThirst @@ -154,7 +183,9 @@ end -- Framework.GetPlayerPhone(src) -- Returns the phone number of the player. 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 end @@ -187,11 +218,14 @@ end -- Sets the player's job to the specified name and grade. Framework.SetPlayerJob = function(src, name, grade) local player = QBox:GetPlayer(src) + if not player then return end return player.Functions.SetJob(name, grade) end 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) end @@ -199,6 +233,7 @@ end -- Adds the specified amount to the player's account balance of the specified type. Framework.AddAccountBalance = function(src, _type, amount) local player = QBox:GetPlayer(src) + if not player then return end if _type == 'money' then _type = 'cash' end return player.Functions.AddMoney(_type, amount) end @@ -207,6 +242,7 @@ end -- Removes the specified amount from the player's account balance of the specified type. Framework.RemoveAccountBalance = function(src, _type, amount) local player = QBox:GetPlayer(src) + if not player then return end if _type == 'money' then _type = 'cash' end return player.Functions.RemoveMoney(_type, amount) end @@ -214,7 +250,9 @@ end -- Framework.GetAccountBalance(src, _type) -- Returns the player's account balance of the specified 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 return playerData.money[_type] end @@ -223,6 +261,7 @@ end -- Adds the specified item to the player's inventory. Framework.AddItem = function(src, item, amount, slot, metadata) 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}) return player.Functions.AddItem(item, amount, slot, metadata) end @@ -231,6 +270,7 @@ end -- Removes the specified item from the player's inventory. Framework.RemoveItem = function(src, item, amount, slot, metadata) 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}) return player.Functions.RemoveItem(item, amount, slot) 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 Framework.SetMetadata = function(src, item, slot, metadata) local player = QBox:GetPlayer(src) + if not player then return end player.Functions.RemoveItem(item, 1, slot) return player.Functions.AddItem(item, 1, slot, metadata) end diff --git a/modules/fuel/BigDaddy-Fuel/client.lua b/modules/fuel/BigDaddy-Fuel/client.lua deleted file mode 100644 index c4ff03e..0000000 --- a/modules/fuel/BigDaddy-Fuel/client.lua +++ /dev/null @@ -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 diff --git a/modules/fuel/_defualts/client.lua b/modules/fuel/_defualts/client.lua index 7b1055b..b6213e5 100644 --- a/modules/fuel/_defualts/client.lua +++ b/modules/fuel/_defualts/client.lua @@ -1,5 +1,5 @@ Fuel = Fuel or {} - +----print("Fuel: Loading Defualt") Fuel.GetFuel = function(vehicle) if not DoesEntityExist(vehicle) then return 0.0 end return GetVehicleFuelLevel(vehicle) diff --git a/modules/fuel/bigDaddy-Fuel/client.lua b/modules/fuel/bigDaddy-Fuel/client.lua new file mode 100644 index 0000000..f1f0a46 --- /dev/null +++ b/modules/fuel/bigDaddy-Fuel/client.lua @@ -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 diff --git a/modules/fuel/cdn-fuel/client.lua b/modules/fuel/cdn-fuel/client.lua index 486519c..bb5b1d7 100644 --- a/modules/fuel/cdn-fuel/client.lua +++ b/modules/fuel/cdn-fuel/client.lua @@ -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.GetFuel = function(vehicle) @@ -6,7 +10,7 @@ Fuel.GetFuel = function(vehicle) return exports['cdn-fuel']:GetFuel(vehicle) end -Fuel.SetFuel = function(vehicle, fuel, type) +Fuel.SetFuel = function(vehicle, fuel) if not DoesEntityExist(vehicle) then return end return exports['cdn-fuel']:SetFuel(vehicle, fuel) end \ No newline at end of file diff --git a/modules/fuel/esx-sna-fuel/client.lua b/modules/fuel/esx-sna-fuel/client.lua index 774fc6d..acfac8d 100644 --- a/modules/fuel/esx-sna-fuel/client.lua +++ b/modules/fuel/esx-sna-fuel/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/lc_fuel/client.lua b/modules/fuel/lc_fuel/client.lua new file mode 100644 index 0000000..235a12a --- /dev/null +++ b/modules/fuel/lc_fuel/client.lua @@ -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 \ No newline at end of file diff --git a/modules/fuel/LegacyFuel/client.lua b/modules/fuel/legacyfuel/client.lua similarity index 54% rename from modules/fuel/LegacyFuel/client.lua rename to modules/fuel/legacyfuel/client.lua index 524f590..d788982 100644 --- a/modules/fuel/LegacyFuel/client.lua +++ b/modules/fuel/legacyfuel/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/okokGasStation/client.lua b/modules/fuel/okokGasStation/client.lua index 78c4f42..147588f 100644 --- a/modules/fuel/okokGasStation/client.lua +++ b/modules/fuel/okokGasStation/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/ox_fuel/client.lua b/modules/fuel/ox_fuel/client.lua index 2032591..730fe27 100644 --- a/modules/fuel/ox_fuel/client.lua +++ b/modules/fuel/ox_fuel/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/ps-fuel/client.lua b/modules/fuel/ps-fuel/client.lua index 590122f..87ad695 100644 --- a/modules/fuel/ps-fuel/client.lua +++ b/modules/fuel/ps-fuel/client.lua @@ -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.GetFuel = function(vehicle) if not DoesEntityExist(vehicle) then return 0.0 end - return exports['ps-fuel']:GetFuel(vehicle) + return exports["ps-fuel"]:GetFuel(vehicle) end Fuel.SetFuel = function(vehicle, fuel, type) if not DoesEntityExist(vehicle) then return end - return exports['ps-fuel']:SetFuel(vehicle, fuel) + return exports["ps-fuel"]:SetFuel(vehicle, fuel) end \ No newline at end of file diff --git a/modules/fuel/qs-fuelstations/client.lua b/modules/fuel/qs-fuelstations/client.lua index ae19c7b..40007f8 100644 --- a/modules/fuel/qs-fuelstations/client.lua +++ b/modules/fuel/qs-fuelstations/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/Renewed-Fuel/client.lua b/modules/fuel/renewed-Fuel/client.lua similarity index 54% rename from modules/fuel/Renewed-Fuel/client.lua rename to modules/fuel/renewed-Fuel/client.lua index 7a44d74..52cf8ac 100644 --- a/modules/fuel/Renewed-Fuel/client.lua +++ b/modules/fuel/renewed-Fuel/client.lua @@ -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.GetFuel = function(vehicle) diff --git a/modules/fuel/ti_fuel/client.lua b/modules/fuel/ti_fuel/client.lua index 55eac90..08779a8 100644 --- a/modules/fuel/ti_fuel/client.lua +++ b/modules/fuel/ti_fuel/client.lua @@ -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.GetFuel = function(vehicle) - if not DoesEntityExist(vehicle) then return 0.0, type end - local level, type = exports["ti_fuel"]:getFuel(vehicle) - return level, type + if not DoesEntityExist(vehicle) then return 0.0 end + local level, _ = exports["ti_fuel"]:getFuel(vehicle) + return level end -Fuel.SetFuel = function(vehicle, fuel, type) +Fuel.SetFuel = function(vehicle, fuel) 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 \ No newline at end of file diff --git a/modules/fuel/x-fuel/client.lua b/modules/fuel/x-fuel/client.lua index 22b59c1..0af0b38 100644 --- a/modules/fuel/x-fuel/client.lua +++ b/modules/fuel/x-fuel/client.lua @@ -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.GetFuel = function(vehicle) - if not DoesEntityExist(vehicle) then return 0.0, type end - local level, type = exports["x-fuel"]:getFuel(vehicle) - return level, type + if not DoesEntityExist(vehicle) then return 0.0 end + local level, _ = exports["x-fuel"]:getFuel(vehicle) + return level end -Fuel.SetFuel = function(vehicle, fuel, type) +Fuel.SetFuel = function(vehicle, fuel) if not DoesEntityExist(vehicle) then return end return exports['x-fuel']:SetFuel(vehicle, fuel) end \ No newline at end of file diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index bd5f17b..1cb439d 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -1,14 +1,22 @@ Inventory = Inventory or {} +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) - print('client funct') return Framework.GetItemInfo(item) end +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) return Framework.HasItem(item) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(item) return "https://avatars.githubusercontent.com/u/47620135" end diff --git a/modules/inventory/_default/server.lua b/modules/inventory/_default/server.lua index 565b87f..18f5b23 100644 --- a/modules/inventory/_default/server.lua +++ b/modules/inventory/_default/server.lua @@ -1,38 +1,86 @@ 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) return Framework.AddItem(src, item, count, slot, metadata) 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) item = type(item) == "table" and item.name or item return Framework.RemoveItem(src, item, count, slot, metadata) end +---comment +---@param item string +---@return boolean Inventory.GetItemInfo = function(item) return false, print("This Inventory Has Not Been Bridged For An Item Info Feature.") end +---comment +---@param src number +---@param item string +---@param metadata table +---@return number Inventory.GetItemCount = function(src, item, metadata) return Framework.GetItemCount(src, item, metadata) end +---comment +---@param src number +---@return table Inventory.GetPlayerInventory = function(src) return Framework.GetPlayerInventory(src) end +---comment +---@param src number +---@param slot number +---@return table Inventory.GetItemBySlot = function(src, slot) return Framework.GetItemBySlot(src, slot) end +---comment +---@param src number +---@param item string +---@param slot number +---@param metadata table +---@return boolean Inventory.SetMetadata = function(src, item, slot, metadata) return Framework.SetMetadata(src, item, slot, metadata) 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) return false, print("This Inventory Has Not Been Bridged For A Stash Feature.") end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(item) return "https://avatars.githubusercontent.com/u/47620135" end \ No newline at end of file diff --git a/modules/inventory/codem-inventory/client.lua b/modules/inventory/codem-inventory/client.lua index a6bfaad..fc616b5 100644 --- a/modules/inventory/codem-inventory/client.lua +++ b/modules/inventory/codem-inventory/client.lua @@ -3,6 +3,9 @@ Inventory = Inventory or {} local codem = exports['codem-inventory'] +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = codem:GetItemList(item) local repackedTable = { @@ -16,6 +19,8 @@ Inventory.GetItemInfo = function(item) return repackedTable or {} end +---comment +---@return table Inventory.GetPlayerInventory = function() local items = {} local inventory = codem:getUserInventory() @@ -34,6 +39,9 @@ Inventory.GetPlayerInventory = function() return items end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) diff --git a/modules/inventory/codem-inventory/server.lua b/modules/inventory/codem-inventory/server.lua index 0d8a635..55d0b3b 100644 --- a/modules/inventory/codem-inventory/server.lua +++ b/modules/inventory/codem-inventory/server.lua @@ -60,6 +60,14 @@ Inventory.SetMetadata = function(src, item, slot, metadata) return codem:SetItemMetadata(src, slot, metadata) 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) local slotData = codem:GetItemBySlot(src, slot) if not slotData then return {} end @@ -81,4 +89,5 @@ Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" -end \ No newline at end of file +end + diff --git a/modules/inventory/core_inventory/client.lua b/modules/inventory/core_inventory/client.lua index 206e39e..27eb884 100644 --- a/modules/inventory/core_inventory/client.lua +++ b/modules/inventory/core_inventory/client.lua @@ -6,6 +6,9 @@ local core = exports.core_inventory Inventory = Inventory or {} +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index 6ff7faa..7acfbe8 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -4,12 +4,19 @@ Inventory = Inventory or {} local core = exports.core_inventory +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---comment +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(oldplate, newplate) -- have no clue if this will work but fingers crossed local queries = { diff --git a/modules/inventory/jpr-inventory/client.lua b/modules/inventory/jpr-inventory/client.lua index cf5a4df..42f6c98 100644 --- a/modules/inventory/jpr-inventory/client.lua +++ b/modules/inventory/jpr-inventory/client.lua @@ -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 }) end) +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) return jpr:HasItem(item) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) diff --git a/modules/inventory/jpr-inventory/server.lua b/modules/inventory/jpr-inventory/server.lua index ff40531..06b4f12 100644 --- a/modules/inventory/jpr-inventory/server.lua +++ b/modules/inventory/jpr-inventory/server.lua @@ -4,26 +4,64 @@ local jpr = exports['jpr-inventory'] 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) return true 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) TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots }) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---comment +---@param src number +---@param slot number +---@return table Inventory.GetItemBySlot = function(src, slot) local slotData = jpr:GetItemBySlot(src, slot) 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 } end +---comment +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(oldplate, newplate) local queries = { 'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate', @@ -34,4 +72,27 @@ Inventory.UpdatePlate = function(oldplate, newplate) if GetResourceState('jg-mechanic') ~= 'started' then return true end exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) return true +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 \ No newline at end of file diff --git a/modules/inventory/origen_inventory/client.lua b/modules/inventory/origen_inventory/client.lua index e7c139a..e355e7d 100644 --- a/modules/inventory/origen_inventory/client.lua +++ b/modules/inventory/origen_inventory/client.lua @@ -4,6 +4,9 @@ Inventory = Inventory or {} local origin = exports.origen_inventory +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = origin:Items(item) local repackedTable = { @@ -17,16 +20,24 @@ Inventory.GetItemInfo = function(item) return repackedTable or {} end +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) return origin:HasItem(item) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---comment +---@return table Inventory.GetPlayerInventory = function() local items = {} local inventory = origin:GetInventory() diff --git a/modules/inventory/origen_inventory/server.lua b/modules/inventory/origen_inventory/server.lua index 4b35b94..5605d56 100644 --- a/modules/inventory/origen_inventory/server.lua +++ b/modules/inventory/origen_inventory/server.lua @@ -14,6 +14,15 @@ Inventory.RemoveItem = function(src, item, count, slot, metadata) return origen_inventory:removeItem(src, item, count, metadata, slot, true) 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) local itemData = origen_inventory:Items(item) local repackedTable = { diff --git a/modules/inventory/ox_inventory/client.lua b/modules/inventory/ox_inventory/client.lua index dc2f1d0..709f477 100644 --- a/modules/inventory/ox_inventory/client.lua +++ b/modules/inventory/ox_inventory/client.lua @@ -3,6 +3,9 @@ local ox_inventory = exports.ox_inventory Inventory = Inventory or {} +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = ox_inventory:Items(item) if not itemData then return {} end @@ -17,20 +20,32 @@ Inventory.GetItemInfo = function(item) return repackedTable end +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) local itemCount = ox_inventory:Search('count', item) local hasItem = itemCount ~= 0 return hasItem end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---comment +---@return table Inventory.GetPlayerInventory = function() return exports.ox_inventory:GetPlayerItems() end +Inventory.OpenShop = function(shopTitle, shopInventory) + ox_inventory:openInventory("shop", { type = shopTitle, id = 1 }) +end + --Bridge.RegisterModule("Inventory", Inventory) diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index 442b14d..5749bcf 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -4,44 +4,111 @@ local ox_inventory = exports.ox_inventory 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) 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) 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) 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) end +---comment +---@param src number +---@param item string +---@param metadata table +---@return table Inventory.GetItem = function(src, item, metadata) return ox_inventory:GetItem(src, item, metadata, false) end +---comment +---@param src number +---@param slot number +---@return table Inventory.GetItemBySlot = function(src, slot) return ox_inventory:GetSlot(src, slot) end +---comment +---@param src number +---@param item string +---@param metadata table +---@return number Inventory.GetItemCount = function(src, item, metadata) return ox_inventory:GetItemCount(src, item, metadata, false) 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) return ox_inventory:GetInventoryItems(src, false) end +---comment +---@param src number +---@param item string +---@param count number +---@return boolean Inventory.CanCarryItem = function(src, item, count) return ox_inventory:CanCarryItem(src, item, count) 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) return ox_inventory:RegisterStash(id, label, slots, weight, owner) 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) TriggerClientEvent('ox_inventory:openInventory', src, 'stash', 'stash_' .. id) end +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = ox_inventory:Items(item) if not itemData then return {} end @@ -51,23 +118,51 @@ Inventory.GetItemInfo = function(item) stack = itemData.stack or "true", weight = itemData.weight or "0", 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 end +---comment +---@param src number +---@param item string +---@param slot number +---@param metadata table +---@return nil Inventory.SetMetadata = function(src, item, slot, metadata) ox_inventory:SetMetadata(src, slot, metadata) end +---comment +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(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) + return true end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" +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 \ No newline at end of file diff --git a/modules/inventory/ps-inventory/client.lua b/modules/inventory/ps-inventory/client.lua index b1f0332..6ffcd0a 100644 --- a/modules/inventory/ps-inventory/client.lua +++ b/modules/inventory/ps-inventory/client.lua @@ -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 }) end) + +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) return ps:HasItem(item) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) diff --git a/modules/inventory/ps-inventory/server.lua b/modules/inventory/ps-inventory/server.lua index d3d2184..2967b58 100644 --- a/modules/inventory/ps-inventory/server.lua +++ b/modules/inventory/ps-inventory/server.lua @@ -4,38 +4,93 @@ local sloth = exports['ps-inventory'] 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) return true 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) TriggerClientEvent('community_bridge:client:ps-inventory:openStash', src, id, { label = label, maxweight = weight, slots = slots, }) end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" 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) local slotData = sloth:GetItemBySlot(src, slot) 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} 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) 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}) - return exports['ps-inventory']:AddItem(src, item, amount, slot, metadata, 'community_bridge') + return sloth:AddItem(src, item, amount, slot, metadata, 'community_bridge') 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) 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}) - return exports['ps-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge') + return sloth:RemoveItem(src, item, amount, slot, 'community_bridge') end + +---comment +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(oldplate, newplate) local queries = { 'UPDATE gloveboxitems SET plate = @newplate WHERE plate = @oldplate', @@ -46,4 +101,26 @@ Inventory.UpdatePlate = function(oldplate, newplate) if GetResourceState('jg-mechanic') ~= 'started' then return true end exports["jg-mechanic"]:vehiclePlateUpdated(oldplate, newplate) return true +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 \ No newline at end of file diff --git a/modules/inventory/qb-inventory/client.lua b/modules/inventory/qb-inventory/client.lua index cfe6b5c..c699953 100644 --- a/modules/inventory/qb-inventory/client.lua +++ b/modules/inventory/qb-inventory/client.lua @@ -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 }) end) +---This will return a boolean if the player has the item in their inventory +---@param item string +---@return boolean Inventory.HasItem = function(item) return qb:HasItem(item) end +---This will return a string of the image path for the item +---@param item string +---@return string Inventory.GetImagePath = function(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) diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index afcd323..3e83d72 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -12,20 +12,55 @@ local function getInventoryNewVersion() 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) return true 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) TriggerClientEvent('community_bridge:client:qb-inventory:openStash', src, id, { weight = weight, slots = slots }) end + +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" 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) local slotData = qbInventory:GetItemBySlot(src, slot) if not slotData then return {} end @@ -41,6 +76,11 @@ Inventory.GetItemBySlot = function(src, slot) } end + +---comment +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(oldplate, newplate) local newVersion = getInventoryNewVersion() 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}) return exports['qb-inventory']:RemoveItem(src, item, amount, slot, 'community_bridge') 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 \ No newline at end of file diff --git a/modules/inventory/qs-inventory/client.lua b/modules/inventory/qs-inventory/client.lua index 819abe6..797e9f3 100644 --- a/modules/inventory/qs-inventory/client.lua +++ b/modules/inventory/qs-inventory/client.lua @@ -3,10 +3,16 @@ local quasar = exports["qs-inventory"] Inventory = Inventory or {} +---comment +---@param id any +---@return nil Inventory.OpenStash = function(id) quasar:RegisterStash(id, 50, 50000) end +---comment +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = quasar:GetItemList() if not itemData[item] then return {} end @@ -21,17 +27,25 @@ Inventory.GetItemInfo = function(item) return repackedTable end +---comment +---@param item string +---@return boolean Inventory.HasItem = function(item) local check = quasar:Search(item) return check and true or false end +---comment +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---comment +---@return table Inventory.GetPlayerInventory = function() local items = {} local inventory = quasar:getUserInventory() diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua index f42b0a1..a3496d1 100644 --- a/modules/inventory/qs-inventory/server.lua +++ b/modules/inventory/qs-inventory/server.lua @@ -4,21 +4,43 @@ local quasar = exports['qs-inventory'] 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) 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}) return quasar:AddItem(src, item, count, slot, metadata) 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) 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) 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) return quasar:GetItemTotalAmount(src, item) end +---This will return the player inventory in a table following ox_inventory format +---@param src number +---@return table Inventory.GetPlayerInventory = function(src) local playerItems = quasar:GetInventory(src) local repackedTable = {} @@ -33,6 +55,20 @@ Inventory.GetPlayerInventory = function(src) return repackedTable 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) local playerItems = quasar:GetInventory(src) for _, item in pairs(playerItems) do @@ -52,19 +88,44 @@ Inventory.GetItemBySlot = function(src, slot) return nil 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) return quasar:CanCarryItem(src, item, count) 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) return true 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) TriggerEvent("inventory:server:OpenInventory", "stash", id, { maxweight = weight, slots = slots }) TriggerClientEvent("inventory:client:SetCurrentStash",src, id) end +---This will return the data to an item +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = quasar:GetItemList() if not itemData[item] then return {} end @@ -79,16 +140,27 @@ Inventory.GetItemInfo = function(item) return repackedTable end + +---@param src number +---@param item string +---@param slot number +---@param metadata table +---@return boolean Inventory.SetMetadata = function(src, item, slot, metadata) return quasar:SetItemMetadata(src, slot, metadata) end +---@param item string +---@return string Inventory.GetImagePath = function(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) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---@param oldplate string +---@param newplate string +---@return boolean Inventory.UpdatePlate = function(oldplate, newplate) local queries = { 'UPDATE inventory_trunk SET plate = @newplate WHERE plate = @oldplate', diff --git a/modules/inventory/tgiann-inventory/client.lua b/modules/inventory/tgiann-inventory/client.lua index bef81e4..5407c52 100644 --- a/modules/inventory/tgiann-inventory/client.lua +++ b/modules/inventory/tgiann-inventory/client.lua @@ -3,10 +3,14 @@ local tgiann = exports["tgiann-inventory"] Inventory = Inventory or {} +---@param id any +---@return nil Inventory.OpenStash = function(id) -- open stash export... not sure what it is yet. end +---@param item string +---@return table Inventory.GetItemInfo = function(item) local itemData = tgiann:GetItemList() if not itemData[item] then return {} end @@ -21,10 +25,16 @@ Inventory.GetItemInfo = function(item) return repackedTable end +---This will return a boolean if the player has the item in the inventory +---@param item string +---@return boolean Inventory.HasItem = function(item) return tgiann:HasItem(item) end +-- This will return the image path, it is incredibley useful for menus etc +---@param item string +---@return string Inventory.GetImagePath = function(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)) @@ -32,6 +42,8 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +---This will return the player inventory in a table +---@return table Inventory.GetPlayerInventory = function() local items = {} local inventory = tgiann:GetPlayerItems() diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index 48e1bd6..0456e1d 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -4,17 +4,36 @@ local tgiann = exports["tgiann-inventory"] 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) 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}) return tgiann:AddItem(src, item, count, slot, metadata, false) 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) 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) end +-- +---@param src number +---@param item string +---@param metadata table +---@return table Inventory.GetItem = function(src, item, metadata) local item = tgiann:GetItemByName(src, item, metadata) item.count = item.amount @@ -22,11 +41,27 @@ Inventory.GetItem = function(src, item, metadata) return item 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) local _item = tgiann:GetItemByName(src, item, metadata) return _item.amount or 0 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) local inventory = tgiann:GetPlayerItems(src) local items = {} @@ -38,20 +73,39 @@ Inventory.GetPlayerInventory = function(src) return items 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) return tgiann:CanCarryItem(src, item, count) 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) return tgiann:CreateCustomStashWithItem(id, {}) 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) local item = tgiann:GetItemBySlot(src, slot) 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} 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) local itemData = tgiann:GetItemList() if not itemData[item] then return {} end @@ -66,10 +120,20 @@ Inventory.GetItemInfo = function(item) return repackedTable 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) tgiann:UpdateItemMetadata(src, item, slot, metadata) end +---This will return the image path for the item +---@param item string +---@return string Inventory.GetImagePath = function(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)) @@ -77,6 +141,10 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" 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) local queries = { 'UPDATE tgiann_inventory_trunkitems SET plate = @newplate WHERE plate = @oldplate', diff --git a/modules/managment/Renewed-Banking/server.lua b/modules/managment/Renewed-Banking/server.lua index c030fc2..4a952de 100644 --- a/modules/managment/Renewed-Banking/server.lua +++ b/modules/managment/Renewed-Banking/server.lua @@ -1,5 +1,5 @@ if GetResourceState('Renewed-Banking') ~= 'started' then return end -Managment = {} +Managment = Managment or {} Managment.GetAccountMoney = function(account) return exports['Renewed-Banking']:getAccountMoney(account) diff --git a/modules/managment/_default/server.lua b/modules/managment/_default/server.lua new file mode 100644 index 0000000..26593d6 --- /dev/null +++ b/modules/managment/_default/server.lua @@ -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 \ No newline at end of file diff --git a/modules/managment/okokBanking/server.lua b/modules/managment/okokBanking/server.lua index 6e3934e..90ad050 100644 --- a/modules/managment/okokBanking/server.lua +++ b/modules/managment/okokBanking/server.lua @@ -1,5 +1,5 @@ if GetResourceState('okokBanking') ~= 'started' then return end -Managment = {} +Managment = Managment or {} Managment.GetAccountMoney = function(account) return exports['okokBanking']:GetAccount(account) diff --git a/modules/managment/qb-banking/server.lua b/modules/managment/qb-banking/server.lua index 8a7a640..5a7facf 100644 --- a/modules/managment/qb-banking/server.lua +++ b/modules/managment/qb-banking/server.lua @@ -1,5 +1,5 @@ if GetResourceState('qb-banking') ~= 'started' then return end -Managment = {} +Managment = Managment or {} Managment.GetAccountMoney = function(account) return exports['qb-banking']:GetAccountBalance(account) diff --git a/modules/menu/_oxlib.lua b/modules/menu/_oxlib.lua index 46cc0e1..c1e78cf 100644 --- a/modules/menu/_oxlib.lua +++ b/modules/menu/_oxlib.lua @@ -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 {} --- Converts a QB menu to an Ox menu. ---@param id string The menu ID. diff --git a/modules/menu/_qb-menu.lua b/modules/menu/_qb-menu.lua index 9115f79..511495a 100644 --- a/modules/menu/_qb-menu.lua +++ b/modules/menu/_qb-menu.lua @@ -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") --- Converts an Ox menu to a QB menu. ---@param id string The menu ID. diff --git a/modules/notify/_default/client.lua b/modules/notify/_default/client.lua index a796cb9..743e348 100644 --- a/modules/notify/_default/client.lua +++ b/modules/notify/_default/client.lua @@ -2,6 +2,11 @@ Notify = Notify or {} local notifyType = BridgeClientConfig.NotifySystem local helptextType = BridgeClientConfig.ShowHelpText +---comment +---@param message string +---@param _type string +---@param time number +---@return nil Notify.SendNotify = function(message, _type, time) time = time or 3000 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, }) elseif notifyType == 'wasabi' then 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 return Prints.Error("You have not set up a custom notify in community_bridge") else @@ -27,6 +34,10 @@ Notify.SendNotify = function(message, _type, time) end end +---comment +---@param message string +---@param _position string +---@return nil Notify.ShowHelpText = function(message, _position) if helptextType == 'ox' then if _position == nil then _position = 'left-center' end diff --git a/modules/notify/_default/server.lua b/modules/notify/_default/server.lua index fd2c122..759bdb2 100644 --- a/modules/notify/_default/server.lua +++ b/modules/notify/_default/server.lua @@ -1,9 +1,18 @@ Notify = Notify or {} +---comment +---@param src number +---@param message string +---@param _type string +---@param time number Notify.SendNotify = function(src, message, _type, time) TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time) end +---comment +---@param src number +---@param message string +---@param position string Notify.ShowHelpText = function(src, message, position) TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position) end diff --git a/modules/phone/gksphone/client.lua b/modules/phone/gksphone/client.lua index d8ddb8f..45bfa53 100644 --- a/modules/phone/gksphone/client.lua +++ b/modules/phone/gksphone/client.lua @@ -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) return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message }) end \ No newline at end of file diff --git a/modules/phone/gksphone/server.lua b/modules/phone/gksphone/server.lua index 0d50297..1796a95 100644 --- a/modules/phone/gksphone/server.lua +++ b/modules/phone/gksphone/server.lua @@ -1,11 +1,21 @@ -if GetResourceState('gksphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "gksphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end - -Phone = {} +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 or {} +---comment +---@param src number +---@return number||boolean Phone.GetPlayerPhone = function(src) return exports["gksphone"]:GetPhoneBySource(src) or false end +---comment +---@param src number +---@param email string +---@param title string +---@param message string +---@return boolean Phone.SendEmail = function(src, email, title, message) local data = {} data.sender = email diff --git a/modules/phone/lb-phone/client.lua b/modules/phone/lb-phone/client.lua index 8eb3fe6..97e556c 100644 --- a/modules/phone/lb-phone/client.lua +++ b/modules/phone/lb-phone/client.lua @@ -1,7 +1,13 @@ -if GetResourceState('lb-phone') ~= 'started' or (BridgeSharedConfig.Phone ~= "lb-phone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end - -Phone = {} +local resourceName = "lb-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 email string +---@param title string +---@param message string +---@return nil Phone.SendEmail = function(email, title, message) TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message}) end \ No newline at end of file diff --git a/modules/phone/lb-phone/server.lua b/modules/phone/lb-phone/server.lua index f298707..c6ddad1 100644 --- a/modules/phone/lb-phone/server.lua +++ b/modules/phone/lb-phone/server.lua @@ -1,11 +1,18 @@ -if GetResourceState('lb-phone') ~= 'started' or (BridgeSharedConfig.Phone ~= "lb-phone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end - -Phone = {} +local resourceName = "lb-phone" +local configValue = BridgeSharedConfig.Phone +if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end +Phone = Phone or {} Phone.GetPlayerPhone = function(src) return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false end +---comment +---@param src number +---@param email string +---@param title string +---@param message string +---@return boolean Phone.SendEmail = function(src, email, title, message) local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src) if not numberNumber then return false, Prints.Error("Could not Find Phone number") end diff --git a/modules/phone/qs-smartphone/client.lua b/modules/phone/qs-smartphone/client.lua index 4194a00..b482589 100644 --- a/modules/phone/qs-smartphone/client.lua +++ b/modules/phone/qs-smartphone/client.lua @@ -1,7 +1,13 @@ -if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "qs-smartphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end - -Phone = {} +local resourceName = "qs-smartphone" +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 email string +---@param title string +---@param message string +---@return nil Phone.SendEmail = function(email, title, message) return TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} }) end diff --git a/modules/phone/qs-smartphone/server.lua b/modules/phone/qs-smartphone/server.lua index 5694c32..b5e3f96 100644 --- a/modules/phone/qs-smartphone/server.lua +++ b/modules/phone/qs-smartphone/server.lua @@ -1,10 +1,20 @@ -if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "qs-smartphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end -Phone = {} - +local resourceName = "qs-smartphone" +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) return exports['qs-base']:GetPlayerPhone(src) or false end +---comment +---@param src number +---@param email string +---@param title string +---@param message string +---@return boolean Phone.SendEmail = function(src, email, title, message) TriggerClientEvent('community_bridge:Server:genericEmail', src, { sender = email, subject = title, message = message, button = {} }) return true diff --git a/modules/progressbar/ox_lib/client.lua b/modules/progressbar/ox_lib/client.lua index f7a002e..99448d7 100644 --- a/modules/progressbar/ox_lib/client.lua +++ b/modules/progressbar/ox_lib/client.lua @@ -1,44 +1,7 @@ --- if BridgeClientConfig.ProgressBar ~= "ox" then return end --- Progressbar = {} --- local _progBarType = BridgeClientConfig.ProgressBarStyle or "bar" +local resourceName = "ox_lib" +local configValue = BridgeClientConfig.ProgressBarSystem +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 {} local function convertFromQB(options) @@ -81,18 +44,24 @@ local function convertFromQB(options) } end +---comment +---@param options table +---@param cb any +---@param isQBInput boolean +---@return nil function ProgressBar.Open(options, cb, isQBInput) if isQBInput then options = convertFromQB(options) end - + local style = options.style or 'bar' local success = style == 'circle' and exports.ox_lib:progressCircle(options) or exports.ox_lib:progressBar(options) - + if cb then cb(not success) end return success end +--[[ RegisterCommand("progressbar", function() ProgressBar.Open({ duration = 5000, @@ -109,3 +78,4 @@ RegisterCommand("progressbar", function() print(cancelled and "Cancelled" or "Complete") end) end) +--]] diff --git a/modules/progressbar/qb-progressbar/client.lua b/modules/progressbar/qb-progressbar/client.lua index 3092381..2fb16bc 100644 --- a/modules/progressbar/qb-progressbar/client.lua +++ b/modules/progressbar/qb-progressbar/client.lua @@ -1,66 +1,7 @@ --- if BridgeClientConfig.ProgressBar ~= "qb" then return end --- Progressbar = {} +local resourceName = "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 {} local function convertFromOx(options) @@ -98,18 +39,24 @@ local function convertFromOx(options) } end +---comment +---@param options table +---@param cb any +---@param qbFormat boolean +---@return nil function ProgressBar.Open(options, cb, qbFormat) if not exports['progressbar'] then return false end - + if not qbFormat then options = convertFromOx(options) end - + exports['progressbar']:Progress(options, cb) end -- Example usage: +--[[ RegisterCommand("progressbar", function() ProgressBar.Open({ duration = 5000, @@ -131,3 +78,4 @@ RegisterCommand("progressbar", function() print(cancelled and "Cancelled" or "Complete") end) end) +--]] \ No newline at end of file diff --git a/modules/shops/_default/client.lua b/modules/shops/_default/client.lua new file mode 100644 index 0000000..e68c3b4 --- /dev/null +++ b/modules/shops/_default/client.lua @@ -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 \ No newline at end of file diff --git a/modules/shops/_default/server.lua b/modules/shops/_default/server.lua new file mode 100644 index 0000000..edf4737 --- /dev/null +++ b/modules/shops/_default/server.lua @@ -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) \ No newline at end of file diff --git a/modules/target/_defualt/client.lua b/modules/target/_defualt/client.lua index 6c3a7ca..bc9b892 100644 --- a/modules/target/_defualt/client.lua +++ b/modules/target/_defualt/client.lua @@ -1,7 +1,7 @@ Target = Target or {} 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 Target.AddGlobalPlayer = function(options) diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index 332e170..422a64e 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -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 function detectDebugEnabled() @@ -28,16 +31,25 @@ Target.FixOptions = function(options) return options end +---comment +---@param options table +---@return nil Target.AddGlobalPlayer = function(options) options = Target.FixOptions(options) ox_target:addGlobalPlayer(options) end +---comment +---@param options table +---@return nil Target.AddGlobalVehicle = function(options) options = Target.FixOptions(options) ox_target:addGlobalVehicle(options) end +---comment +---@param options table +---@return nil Target.RemoveGlobalVehicle = function(options) local assembledLables = {} for k, v in pairs(options) do @@ -46,16 +58,31 @@ Target.RemoveGlobalVehicle = function(options) ox_target:removeGlobalVehicle(assembledLables) end +---comment +---@param entities table +---@param options table +---@return nil Target.AddLocalEntity = function(entities, options) options = Target.FixOptions(options) ox_target:addLocalEntity(entities, options) end +---comment +---@param models table +---@param options table +---@return nil Target.AddModel = function(models, options) options = Target.FixOptions(options) ox_target:addModel(models, options) 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) options = Target.FixOptions(options) local target = ox_target:addBoxZone({ @@ -73,14 +100,23 @@ Target.RemoveGlobalPlayer = function() ox_target:removeGlobalPlayer() end +---comment +---@param entity number +---@return nil Target.RemoveLocalEntity = function(entity) ox_target:removeLocalEntity(entity) end +---comment +---@param model string +---@return nil Target.RemoveModel = function(model) ox_target:removeModel(model) end +---comment +---@param name string +---@return nil Target.RemoveZone = function(name) for _, data in pairs(targetZones) do if data.name == name then diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index 72a7001..bf627bb 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -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 function detectDebugEnabled() diff --git a/modules/target/sleepless_interact/client.lua b/modules/target/sleepless_interact/client.lua index d3870cd..01315b0 100644 --- a/modules/target/sleepless_interact/client.lua +++ b/modules/target/sleepless_interact/client.lua @@ -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 diff --git a/modules/vehicleKey/F_RealCarKeysSystem/client/client.lua b/modules/vehicleKey/F_RealCarKeysSystem/client/client.lua index 5a9f367..6013011 100644 --- a/modules/vehicleKey/F_RealCarKeysSystem/client/client.lua +++ b/modules/vehicleKey/F_RealCarKeysSystem/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) + if not plate then return false end TriggerServerEvent('F_RealCarKeysSystem:generateVehicleKeys', plate) end VehicleKey.RemoveKeys = function(vehicle, plate) - return + return true end diff --git a/modules/vehicleKey/MrNewbVehicleKeys/client/client.lua b/modules/vehicleKey/MrNewbVehicleKeys/client/client.lua index 55689b2..7cf6df9 100644 --- a/modules/vehicleKey/MrNewbVehicleKeys/client/client.lua +++ b/modules/vehicleKey/MrNewbVehicleKeys/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) - if not DoesEntityExist(vehicle) and not plate then return false end - return exports.MrNewbVehicleKeys:GiveKeys(vehicle) + if not plate then return false end + return exports.MrNewbVehicleKeys:GiveKeysByPlate(plate) end VehicleKey.RemoveKeys = function(vehicle, plate) - if not vehicle and not plate then return false end - if not DoesEntityExist(vehicle) then return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate) end - return exports.MrNewbVehicleKeys:RemoveKeys(vehicle) + if not plate then return false end + return exports.MrNewbVehicleKeys:RemoveKeysByPlate(plate) end \ No newline at end of file diff --git a/modules/vehicleKey/MrNewbVehicleKeys/server/server.lua b/modules/vehicleKey/MrNewbVehicleKeys/server/server.lua deleted file mode 100644 index c584568..0000000 --- a/modules/vehicleKey/MrNewbVehicleKeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/Renewed-Vehiclekeys/client/client.lua b/modules/vehicleKey/Renewed-Vehiclekeys/client/client.lua index 21b7028..4344bb7 100644 --- a/modules/vehicleKey/Renewed-Vehiclekeys/client/client.lua +++ b/modules/vehicleKey/Renewed-Vehiclekeys/client/client.lua @@ -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.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) end 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) end \ No newline at end of file diff --git a/modules/vehicleKey/Renewed-Vehiclekeys/server/server.lua b/modules/vehicleKey/Renewed-Vehiclekeys/server/server.lua deleted file mode 100644 index 78f76ef..0000000 --- a/modules/vehicleKey/Renewed-Vehiclekeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/_default/client/client.lua b/modules/vehicleKey/_default/client/client.lua index af15d71..da6a547 100644 --- a/modules/vehicleKey/_default/client/client.lua +++ b/modules/vehicleKey/_default/client/client.lua @@ -1,9 +1,9 @@ VehicleKey = VehicleKey or {} VehicleKey.GiveKeys = function(vehicle, plate) - -- wip + return true, print("There Is No Vehicle Key System Installed") end VehicleKey.RemoveKeys = function(vehicle, plate) - -- wip + return true, print("There Is No Vehicle Key System Installed") end \ No newline at end of file diff --git a/modules/vehicleKey/_default/server/server.lua b/modules/vehicleKey/_default/server/server.lua deleted file mode 100644 index 26b525d..0000000 --- a/modules/vehicleKey/_default/server/server.lua +++ /dev/null @@ -1,9 +0,0 @@ -VehicleKey = VehicleKey or {} - -VehicleKey.GiveKeys = function(src, vehicle, plate) - --wip -end - -VehicleKey.RemoveKeys = function(src, vehicle, plate) - -- wip -end \ No newline at end of file diff --git a/modules/vehicleKey/cd_garage/client/client.lua b/modules/vehicleKey/cd_garage/client/client.lua index b83de16..936e1d0 100644 --- a/modules/vehicleKey/cd_garage/client/client.lua +++ b/modules/vehicleKey/cd_garage/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) + if not plate then return false end TriggerEvent('cd_garage:AddKeys', plate) end VehicleKey.RemoveKeys = function(vehicle, plate) - + return true end \ No newline at end of file diff --git a/modules/vehicleKey/cd_garage/server/server.lua b/modules/vehicleKey/cd_garage/server/server.lua deleted file mode 100644 index e69d70c..0000000 --- a/modules/vehicleKey/cd_garage/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/jacksam/client.lua b/modules/vehicleKey/jacksam/client.lua new file mode 100644 index 0000000..2b2f643 --- /dev/null +++ b/modules/vehicleKey/jacksam/client.lua @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/mk_vehiclekeys/client/client.lua b/modules/vehicleKey/mk_vehiclekeys/client/client.lua index 82debda..c39def4 100644 --- a/modules/vehicleKey/mk_vehiclekeys/client/client.lua +++ b/modules/vehicleKey/mk_vehiclekeys/client/client.lua @@ -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.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) end 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) end \ No newline at end of file diff --git a/modules/vehicleKey/mk_vehiclekeys/server/server.lua b/modules/vehicleKey/mk_vehiclekeys/server/server.lua deleted file mode 100644 index d14ad51..0000000 --- a/modules/vehicleKey/mk_vehiclekeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/mono_carkeys/client/client.lua b/modules/vehicleKey/mono_carkeys/client/client.lua index 3180d32..03790d3 100644 --- a/modules/vehicleKey/mono_carkeys/client/client.lua +++ b/modules/vehicleKey/mono_carkeys/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) - if type(plate) ~= 'string' then return end + if not plate then return false end TriggerServerEvent('mono_carkeys:CreateKey', plate) end 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) end diff --git a/modules/vehicleKey/okokGarage/client/client.lua b/modules/vehicleKey/okokGarage/client/client.lua index afea250..3d62e22 100644 --- a/modules/vehicleKey/okokGarage/client/client.lua +++ b/modules/vehicleKey/okokGarage/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) + if not plate then return false end TriggerServerEvent('okokGarage:GiveKeys', plate) end diff --git a/modules/vehicleKey/okokGarage/server/server.lua b/modules/vehicleKey/okokGarage/server/server.lua deleted file mode 100644 index 702bf82..0000000 --- a/modules/vehicleKey/okokGarage/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/qb-vehiclekeys/client/client.lua b/modules/vehicleKey/qb-vehiclekeys/client/client.lua index 09d3485..3ab78a2 100644 --- a/modules/vehicleKey/qb-vehiclekeys/client/client.lua +++ b/modules/vehicleKey/qb-vehiclekeys/client/client.lua @@ -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.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) end 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) end \ No newline at end of file diff --git a/modules/vehicleKey/qb-vehiclekeys/server/server.lua b/modules/vehicleKey/qb-vehiclekeys/server/server.lua deleted file mode 100644 index e331af6..0000000 --- a/modules/vehicleKey/qb-vehiclekeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/qbx_vehiclekeys/client/client.lua b/modules/vehicleKey/qbx_vehiclekeys/client/client.lua index 3ba123c..8e554a8 100644 --- a/modules/vehicleKey/qbx_vehiclekeys/client/client.lua +++ b/modules/vehicleKey/qbx_vehiclekeys/client/client.lua @@ -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.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) end diff --git a/modules/vehicleKey/qbx_vehiclekeys/server/server.lua b/modules/vehicleKey/qbx_vehiclekeys/server/server.lua deleted file mode 100644 index 1c25ea5..0000000 --- a/modules/vehicleKey/qbx_vehiclekeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/qs-vehiclekeys/client/client.lua b/modules/vehicleKey/qs-vehiclekeys/client/client.lua index 6882001..d9a4423 100644 --- a/modules/vehicleKey/qs-vehiclekeys/client/client.lua +++ b/modules/vehicleKey/qs-vehiclekeys/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) - if not vehicle then return end + if not vehicle then return false end local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) local verifiedPlate = GetVehicleNumberPlateText(vehicle) return exports['qs-vehiclekeys']:GiveKeys(verifiedPlate, model, true) end VehicleKey.RemoveKeys = function(vehicle, plate) - if not vehicle then return end + if not vehicle then return false end local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)) local verifiedPlate = GetVehicleNumberPlateText(vehicle) return exports['qs-vehiclekeys']:RemoveKeys(verifiedPlate, model) -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) \ No newline at end of file +end \ No newline at end of file diff --git a/modules/vehicleKey/qs-vehiclekeys/server/server.lua b/modules/vehicleKey/qs-vehiclekeys/server/server.lua deleted file mode 100644 index 13579d3..0000000 --- a/modules/vehicleKey/qs-vehiclekeys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/t1ger_keys/client/client.lua b/modules/vehicleKey/t1ger_keys/client/client.lua index 6834932..23dd224 100644 --- a/modules/vehicleKey/t1ger_keys/client/client.lua +++ b/modules/vehicleKey/t1ger_keys/client/client.lua @@ -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 {} @@ -10,8 +12,4 @@ end VehicleKey.RemoveKeys = function(vehicle, plate) -end - -RegisterNetEvent("community_bridge:vehicleKey:giveKeys", function(plate) - VehicleKey.GiveKeys(nil, plate) -end) \ No newline at end of file +end \ No newline at end of file diff --git a/modules/vehicleKey/t1ger_keys/server/server.lua b/modules/vehicleKey/t1ger_keys/server/server.lua deleted file mode 100644 index 1130e37..0000000 --- a/modules/vehicleKey/t1ger_keys/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/vehicleKey/wasabi_carlock/client/client.lua b/modules/vehicleKey/wasabi_carlock/client/client.lua index 3bee3e2..8f03b0f 100644 --- a/modules/vehicleKey/wasabi_carlock/client/client.lua +++ b/modules/vehicleKey/wasabi_carlock/client/client.lua @@ -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.GiveKeys = function(vehicle, plate) diff --git a/modules/vehicleKey/wasabi_carlock/server/server.lua b/modules/vehicleKey/wasabi_carlock/server/server.lua deleted file mode 100644 index 36e7689..0000000 --- a/modules/vehicleKey/wasabi_carlock/server/server.lua +++ /dev/null @@ -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 \ No newline at end of file diff --git a/modules/version/server/VersionChecker.lua b/modules/version/server/VersionChecker.lua index 35ecfe3..dde4d03 100644 --- a/modules/version/server/VersionChecker.lua +++ b/modules/version/server/VersionChecker.lua @@ -1,6 +1,16 @@ 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("([^/]+)$") 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', '') 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)) end end, 'GET') diff --git a/modules/weather/qb-weathersync/client/client.lua b/modules/weather/qb-weathersync/client/client.lua index 154a846..e669fac 100644 --- a/modules/weather/qb-weathersync/client/client.lua +++ b/modules/weather/qb-weathersync/client/client.lua @@ -1,6 +1,8 @@ if GetResourceState('qb-weathersync') ~= 'started' then return end Weather = {} +---comment +---@param toggle boolean Weather.ToggleSync = function(toggle) if toggle then TriggerEvent("qb-weathersync:client:EnableSync") diff --git a/modules/weather/qb-weathersync/server/server.lua b/modules/weather/qb-weathersync/server/server.lua deleted file mode 100644 index b03d4c5..0000000 --- a/modules/weather/qb-weathersync/server/server.lua +++ /dev/null @@ -1,6 +0,0 @@ -if GetResourceState('qb-weathersync') ~= 'started' then return end -Weather = {} - -Weather.ToggleSync = function(src, toggle) - -- wip -end \ No newline at end of file diff --git a/modules/weather/renewed-weathersync/client/client.lua b/modules/weather/renewed-weathersync/client/client.lua index a8a1766..d6589c7 100644 --- a/modules/weather/renewed-weathersync/client/client.lua +++ b/modules/weather/renewed-weathersync/client/client.lua @@ -1,6 +1,8 @@ if GetResourceState('Renewed-Weathersync') ~= 'started' then return end Weather = {} +---comment +---@param toggle boolean Weather.ToggleSync = function(toggle) LocalPlayer.state.syncWeather = toggle end \ No newline at end of file diff --git a/modules/weather/renewed-weathersync/server/server.lua b/modules/weather/renewed-weathersync/server/server.lua deleted file mode 100644 index dc6adfc..0000000 --- a/modules/weather/renewed-weathersync/server/server.lua +++ /dev/null @@ -1,6 +0,0 @@ -if GetResourceState('Renewed-Weathersync') ~= 'started' then return end -Weather = {} - -Weather.ToggleSync = function(src, toggle) - -- wip -end \ No newline at end of file diff --git a/modules/weather/vSync/client/client.lua b/modules/weather/vSync/client/client.lua index 154a846..e669fac 100644 --- a/modules/weather/vSync/client/client.lua +++ b/modules/weather/vSync/client/client.lua @@ -1,6 +1,8 @@ if GetResourceState('qb-weathersync') ~= 'started' then return end Weather = {} +---comment +---@param toggle boolean Weather.ToggleSync = function(toggle) if toggle then TriggerEvent("qb-weathersync:client:EnableSync") diff --git a/modules/weather/vSync/server/server.lua b/modules/weather/vSync/server/server.lua deleted file mode 100644 index b03d4c5..0000000 --- a/modules/weather/vSync/server/server.lua +++ /dev/null @@ -1,6 +0,0 @@ -if GetResourceState('qb-weathersync') ~= 'started' then return end -Weather = {} - -Weather.ToggleSync = function(src, toggle) - -- wip -end \ No newline at end of file diff --git a/settings/clientConfig.lua b/settings/clientConfig.lua index 54ae1e2..f89f5a4 100644 --- a/settings/clientConfig.lua +++ b/settings/clientConfig.lua @@ -1,12 +1,13 @@ BridgeClientConfig = {} -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.HelpTextSystem = "auto" -BridgeClientConfig.ShowHelpText = "ox" -- [ox | jg | qb | lab | custom ] -BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ] -BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox | qb ] -BridgeClientConfig.ProgressBarSystem = "auto" -BridgeClientConfig.ZoneSystem = "ox" -- [ ox | poly ] -BridgeClientConfig.ProgressBar = "ox" -- [ ox | qb ] +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.ShowHelpText = "ox" -- [ ox | qb | jg | okok | cd | lab | custom ] +BridgeClientConfig.InputSystem = "auto" -- [ auto | ox | qb ] +BridgeClientConfig.MenuSystem = "auto" -- [ auto | ox_lib | qb-menu ] +BridgeClientConfig.ProgressBarSystem = "auto" -- [ auto | ox_lib | progressbar ] +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.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 \ No newline at end of file diff --git a/settings/serverConfig.lua b/settings/serverConfig.lua index 4ef1c58..abfdd4d 100644 --- a/settings/serverConfig.lua +++ b/settings/serverConfig.lua @@ -1,6 +1,6 @@ BridgeServerConfig = {} -BridgeServerConfig.LogSystem = "builtin" -- [ builtin | qb | ox ] -BridgeServerConfig.WebhookURL = "PUT_WEBHOOK_URL_HERE" +BridgeServerConfig.LogSystem = "ox" -- [ builtin | qb | ox ] +BridgeServerConfig.WebhookURL = "PUT_WEBHOOK_URL_HERE" -- only if using builtin BridgeServerConfig.WebhookImage = "https://cdn.discordapp.com/avatars/299410129982455808/31ce635662206e8bd0132c34ce9ce683?size=1024" BridgeServerConfig.MaxInventorySlots = 50 diff --git a/settings/sharedConfig.lua b/settings/sharedConfig.lua index 366e261..7fe6461 100644 --- a/settings/sharedConfig.lua +++ b/settings/sharedConfig.lua @@ -1,7 +1,6 @@ BridgeSharedConfig = {} 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.VehicleKey = "auto" -- Change this to your prefrence or leave it as auto -BridgeSharedConfig.Phone = "auto" -- Change this to your prefrence or leave it as auto +BridgeSharedConfig.Phone = "auto" -- [ auto | qs-smartphone | lb-phone | gksphone] return BridgeSharedConfig \ No newline at end of file