diff --git a/Config.lua b/Config.lua index c7d8e24..a24b523 100644 --- a/Config.lua +++ b/Config.lua @@ -1,31 +1,35 @@ Config = {} ps = {} -Config.Notify = "ox" -- qb, ox, ps, esx, mad_thoughts -Config.Menus = "ox" -- qb, ox, ps -Config.DrawText = "ox" -- qb, ox, ps +Config.Inventory = "auto" -- auto, ox_inventory, qb-inventory, ps-inventory, lj-inventory, tgiann-inventory, jpr-inventory +Config.Target = "auto" -- auto, ox_target, qb-target, interact +Config.EmoteMenu = "rpemotes" -- rpemotes, dpemotes, scully, anything else for custom +Config.Notify = "ox" -- qb, ox, ps, esx, mad_thoughts, okok, lation +Config.Menus = "ox" -- qb, ox, ps, lation +Config.DrawText = "ox" -- qb, ox, ps, lation, okok +Config.Banking = "qb" -- qb, okok, Renewed, none +Config.VehicleKeys = "qb" -- qb, mrnewb, none Config.ConvertQBMenu = false -- Convert qb-menu to ps-ui context menu and qb-input to ps-ui input Config.Progressbar = { -- these are DEFAULT values, you can override them in the progressbar function - style = "keep", -- qb, oxbar, oxcircle, keep + style = "oxcircle", -- qb, oxbar, oxcircle, keep Movement = true, -- Disable movement CarMovement = true, -- Disable car movement Mouse = true, -- Disable mouse Combat = true, -- Disable combat } -Config.Logs = "fivemerr" -- fivemerr or fivemanage - +Config.Logs = "fivemerr" -- fivemerr or fivemanage QBCore, ESX, qbx, langs = nil, nil, nil if GetResourceState('qbx_core') == 'started' then qbx = exports.qbx_core - langs = GetConvar('ox:locale', 'en') + langs = GetConvar('ox:locale', 'en') or 'en' elseif GetResourceState('es_extended') == 'started' then ESX = exports['es_extended']:getSharedObject() - langs = GetConvar('esx:locale', 'en') + langs = GetConvar('esx:locale', 'en') or 'en' elseif GetResourceState('qb-core') == 'started' then QBCore = exports['qb-core']:GetCoreObject() - langs = GetConvar('qb_locale', 'en') + langs = GetConvar('qb_locale', 'en') or 'en' end \ No newline at end of file diff --git a/bridge/banking/Renewed/server.lua b/bridge/banking/Renewed/server.lua new file mode 100644 index 0000000..31a1c9d --- /dev/null +++ b/bridge/banking/Renewed/server.lua @@ -0,0 +1,35 @@ +ps.success('Banking Module Loaded: Renewed Banking') +function ps.addAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + exports['Renewed-Banking']:addAccountMoney(id, amount) + return true +end + +function ps.removeAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + if exports['Renewed-Banking']:removeAccountMoney(id, amount) then + return true + end + return false +end + +function ps.getAccountMoney(id) + if not id then + return 0 + end + local money = exports['Renewed-Banking']:getAccountMoney(id) + if money then + return money + end + return 0 +end \ No newline at end of file diff --git a/bridge/banking/okok/server.lua b/bridge/banking/okok/server.lua new file mode 100644 index 0000000..d855739 --- /dev/null +++ b/bridge/banking/okok/server.lua @@ -0,0 +1,35 @@ +ps.success('Banking Module Loaded: OKOK Banking') +function ps.addAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + exports['okokBanking']:AddMoney(id, amount) + return true +end + +function ps.removeAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + if exports['okokBanking']:RemoveMoney(id, amount) then + return true + end + return false +end + +function ps.getAccountMoney(id) + if not id then + return 0 + end + local money = exports['okokBanking']:GetAccount(id) + if money then + return money + end + return 0 +end \ No newline at end of file diff --git a/bridge/banking/qb/server.lua b/bridge/banking/qb/server.lua new file mode 100644 index 0000000..495aa55 --- /dev/null +++ b/bridge/banking/qb/server.lua @@ -0,0 +1,41 @@ +ps.success('Banking Module Loaded: QB-Banking') +function ps.addAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + if not reason then + reason = "" + end + exports['qb-banking']:AddMoney(id, amount, reason) + return true +end + +function ps.removeAccountMoney(id, amount, reason) + if not id then + return false + end + if not amount or amount < 0 then + return false + end + if not reason then + reason = "" + end + if exports['qb-banking']:RemoveMoney(id, amount, reason) then + return true + end + return false +end + +function ps.getAccountMoney(id) + if not id then + return 0 + end + local money = exports['qb-banking']:GetBalance(id) + if money then + return money + end + return 0 +end \ No newline at end of file diff --git a/bridge/client.lua b/bridge/client.lua index b55ba0f..9a6e5c8 100644 --- a/bridge/client.lua +++ b/bridge/client.lua @@ -2,9 +2,8 @@ local emote, framework, inventory, target = false, false, false, false -- Emote Loading local emoteResources = { ['rpemotes'] = 'bridge/emote/rp/client.lua', - ['rpemotes-reborn'] = 'bridge/emote/rp/client.lua', ['dpemotes'] = 'bridge/emote/dp/client.lua', - ['scully_emotemenu'] = 'bridge/emote/scully/client.lua', + ['scully'] = 'bridge/emote/scully/client.lua', } local frameworkResources = { @@ -19,6 +18,7 @@ local inventoryResources = { ['lj-inventory'] = 'bridge/inventory/lj/client/lj.lua', ['ps-inventory'] = 'bridge/inventory/ps/client/ps.lua', ['jpr-inventory'] = 'bridge/inventory/jpr/client/jpr.lua', + ['tgiann-inventory'] = 'bridge/inventory/tgiann/client/tgg.lua', } local targetResources = { @@ -59,42 +59,12 @@ local menus = { ['ps'] = 'ps.lua', } +local vehicleKeys = { + ['qb'] = 'bridge/vehiclekeys/qb/client/client.lua', + ['mrnewb'] = 'bridge/vehiclekeys/mrnewb/client/client.lua', +} -local function loadEmotes() - for script, path in pairs(emoteResources) do - if GetResourceState(script) == 'started' then - loadLib(path) - emote = true - ps.success(('Emote resource found: %s'):format(script)) - break - end - end - - if not emote then - loadLib('bridge/emote/custom/client.lua') - ps.warn('No emote resource found: falling back to custom') - end -end - -AddEventHandler('onResourceStart', function(resourceName) - if emoteResources[resourceName] then - loadLib(emoteResources[resourceName]) - ps.success(('Emote resourcedfs started: %s'):format(resourceName)) - emote = resourceName - end -end) - -loadEmotes() - -for k, v in pairs(zones) do - if GetResourceState(v.script) == 'started' then - loadLib(v.path) - ps.success(('Zone resource found: %s'):format(v.script)) - break - end -end - local function loadFramework() for key, v in ipairs(frameworkResources) do if GetResourceState(v.name) == 'started' then @@ -117,7 +87,6 @@ local function loadInventory() if GetResourceState(script) == 'started' then loadLib(path) inventory = script - ps.success(('Inventory resource found: %s'):format(script)) break end end @@ -128,49 +97,59 @@ local function loadInventory() end end -loadInventory() - -AddEventHandler('onResourceStart', function(resourceName) - if inventoryResources[resourceName] then - loadLib(inventoryResources[resourceName]) - ps.success(('Inventory resource started: %s'):format(resourceName)) - end -end) - local function loadTarget() for script, path in pairs(targetResources) do if GetResourceState(script) == 'started' then loadLib(path) - target = script - ps.success(('Target resource found: %s'):format(script)) return end end end -loadTarget() +local function loadAll() + if Config.Inventory ~= 'auto' then + if inventoryResources[Config.Inventory] then + loadLib(inventoryResources[Config.Inventory]) + else + loadLib('bridge/inventory/custom/client/custom.lua') + ps.warn('No inventory resource found: falling back to custom') + end + else + loadInventory() + end -AddEventHandler('onResourceStart', function(resourceName) - if targetResources[resourceName] then - loadLib(targetResources[resourceName]) - ps.success(('Target resource started: %s'):format(resourceName)) + if Config.Target ~= 'auto' then + if targetResources[Config.Target] then + loadLib(targetResources[Config.Target]) + end + else + loadTarget() end -end) -if menus[Config.Menus] then - loadLib('bridge/menus/'..menus[Config.Menus]) - ps.success(('Menu system loaded: %s'):format(Config.Menus)) -end + if menus[Config.Menus] then + loadLib('bridge/menus/'..menus[Config.Menus]) + end -if drawText[Config.DrawText] then - loadLib('bridge/drawtext/'..drawText[Config.DrawText]) - ps.success(('DrawText system loaded: %s'):format(Config.DrawText)) -end -if notify[Config.Notify] then - loadLib('bridge/notify/'..notify[Config.Notify]) - ps.success(('Notify system loaded: %s'):format(Config.Notify)) -end -if progressbars[Config.Progressbar.style] then - loadLib('bridge/progressbars/'..progressbars[Config.Progressbar.style]) - ps.success(('Progressbar system loaded: %s'):format(Config.Progressbar.style)) + if drawText[Config.DrawText] then + loadLib('bridge/drawtext/'..drawText[Config.DrawText]) + end + if notify[Config.Notify] then + loadLib('bridge/notify/'..notify[Config.Notify]) + end + if progressbars[Config.Progressbar.style] then + loadLib('bridge/progressbars/'..progressbars[Config.Progressbar.style]) + end + if vehicleKeys[Config.VehicleKeys] then + loadLib(vehicleKeys[Config.VehicleKeys]) + end + if emoteResources[Config.EmoteMenu] then + loadLib(emoteResources[Config.EmoteMenu]) + end + if GetResourceState('ox_lib') == 'started' then + loadLib('bridge/zones/ox/client.lua') + else + loadLib('bridge/zones/PolyZone/client.lua') + end end + +loadAll() \ No newline at end of file diff --git a/bridge/drawtext/lation.lua b/bridge/drawtext/lation.lua new file mode 100644 index 0000000..863a2d2 --- /dev/null +++ b/bridge/drawtext/lation.lua @@ -0,0 +1,13 @@ +ps.success('Draw Text Module Loaded: Lation UI') + +function ps.drawText(text) + if not text then return end + exports.lation_ui:showText(text) +end + +function ps.hideText() + exports.lation_ui:hideText() +end + +exports('drawText', ps.drawText) +exports('hideText', ps.hideText) \ No newline at end of file diff --git a/bridge/drawtext/okok.lua b/bridge/drawtext/okok.lua new file mode 100644 index 0000000..8d44871 --- /dev/null +++ b/bridge/drawtext/okok.lua @@ -0,0 +1,12 @@ +ps.success('Draw Text Module Loaded: Okok') + +function ps.drawText(text) + if not text then return end + exports['okokTextUI']:Open(text, 'lightgrey', 'right', true) +end + +function ps.hideText() + exports['okokTextUI']:Close() +end +exports('drawText', ps.drawText) +exports('hideText', ps.hideText) \ No newline at end of file diff --git a/bridge/drawtext/ox.lua b/bridge/drawtext/ox.lua index eb5436d..31b5c2a 100644 --- a/bridge/drawtext/ox.lua +++ b/bridge/drawtext/ox.lua @@ -1,3 +1,5 @@ +ps.success('Draw Text Module Loaded: ox_lib') + function ps.drawText(text) if not text then return end lib.showTextUI(text) @@ -5,4 +7,7 @@ end function ps.hideText() lib.hideTextUI() -end \ No newline at end of file +end + +exports('drawText', ps.drawText) +exports('hideText', ps.hideText) \ No newline at end of file diff --git a/bridge/drawtext/ps.lua b/bridge/drawtext/ps.lua index 333ba5c..a2f5909 100644 --- a/bridge/drawtext/ps.lua +++ b/bridge/drawtext/ps.lua @@ -1,3 +1,5 @@ +ps.success('Draw Text Module Loaded: PS-UI') + function ps.drawText(text) if not text then return end exports['ps-ui']:drawText(text, "yellow") @@ -5,4 +7,7 @@ end function ps.hideText() exports['ps-ui']:hideDrawText() -end \ No newline at end of file +end + +exports('drawText', ps.drawText) +exports('hideText', ps.hideText) \ No newline at end of file diff --git a/bridge/drawtext/qb.lua b/bridge/drawtext/qb.lua index aa7699d..40664da 100644 --- a/bridge/drawtext/qb.lua +++ b/bridge/drawtext/qb.lua @@ -1,3 +1,5 @@ +ps.success('Draw Text Module Loaded: QB-Core') + function ps.drawText(text) if not text then return end exports['qb-core']:ShowText(text) @@ -5,4 +7,7 @@ end function ps.hideText() exports['qb-core']:HideText() -end \ No newline at end of file +end + +exports('drawText', ps.drawText) +exports('hideText', ps.hideText) \ No newline at end of file diff --git a/bridge/emote/custom/client.lua b/bridge/emote/custom/client.lua index 8dbb9a3..f7d329a 100644 --- a/bridge/emote/custom/client.lua +++ b/bridge/emote/custom/client.lua @@ -1,3 +1,5 @@ +ps.success('Emote Module Loaded: Custom Emotes') + local props = {} local IsInEmote = false local emotes = { @@ -93,4 +95,7 @@ function ps.cancelEmote() end IsInEmote = false ClearPedTasks(PlayerPedId()) -end \ No newline at end of file +end + +exports('playEmote', ps.playEmote) +exports('cancelEmote', ps.cancelEmote) \ No newline at end of file diff --git a/bridge/emote/dp/client.lua b/bridge/emote/dp/client.lua index 076261b..a071761 100644 --- a/bridge/emote/dp/client.lua +++ b/bridge/emote/dp/client.lua @@ -1,3 +1,5 @@ +ps.success('Emote Module Loaded: DP Emotes') + local props = {} local IsInEmote = false local emotes = { @@ -111,4 +113,7 @@ function ps.playAnims(emote) 8.0, -8.0, -1, 49, 0, false, false, false ) end -end \ No newline at end of file +end + +exports('playEmote', ps.playEmote) +exports('cancelEmote', ps.cancelEmote) \ No newline at end of file diff --git a/bridge/emote/rp/client.lua b/bridge/emote/rp/client.lua index b35978e..6c60b93 100644 --- a/bridge/emote/rp/client.lua +++ b/bridge/emote/rp/client.lua @@ -1,4 +1,4 @@ - +ps.success('Emote Module Loaded: RP Emotes') local props = {} local IsInEmote = false local emotes = { @@ -132,3 +132,6 @@ function ps.playAnims(emote) ) end end + +exports('playEmote', ps.playEmote) +exports('cancelEmote', ps.cancelEmote) \ No newline at end of file diff --git a/bridge/emote/scully/client.lua b/bridge/emote/scully/client.lua index e0220f2..5b73e2e 100644 --- a/bridge/emote/scully/client.lua +++ b/bridge/emote/scully/client.lua @@ -1,4 +1,4 @@ - +ps.success('Emote Module Loaded: RP Emotes') local props = {} local IsInEmote = false local emotes = { @@ -114,3 +114,5 @@ function ps.playAnims(emote) end end +exports('playEmote', ps.playEmote) +exports('cancelEmote', ps.cancelEmote) \ No newline at end of file diff --git a/bridge/inventory/custom/client/custom.lua b/bridge/inventory/custom/client/custom.lua index 3fbd0e6..2531688 100644 --- a/bridge/inventory/custom/client/custom.lua +++ b/bridge/inventory/custom/client/custom.lua @@ -1,3 +1,5 @@ +ps.success('Inventory Module Loaded: Custom Inventory') + -- returns path for image like nui://qb-inventory/html/images/item_image.png function ps.getImage(item) @@ -26,3 +28,8 @@ function ps.hasItems(items) end return true end + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/custom/server/custom.lua b/bridge/inventory/custom/server/custom.lua index b415d12..cefc2fa 100644 --- a/bridge/inventory/custom/server/custom.lua +++ b/bridge/inventory/custom/server/custom.lua @@ -1,4 +1,5 @@ --- function to remove item needs return true +ps.success('Inventory Module Loaded: Custom Inventory') function ps.removeItem(identifier, item, amount, slot, reason) if not identifier or not item then return end if not amount then amount = 1 end @@ -102,4 +103,19 @@ function ps.craftItem(source, recipe) end end return true -end \ No newline at end of file +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) \ No newline at end of file diff --git a/bridge/inventory/jpr/client/jpr.lua b/bridge/inventory/jpr/client/jpr.lua index c09b009..7a0fd1c 100644 --- a/bridge/inventory/jpr/client/jpr.lua +++ b/bridge/inventory/jpr/client/jpr.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: JPR Inventory') function ps.getImage(item) local itemData = QBCore.Shared.Items[item] if itemData then @@ -31,3 +31,8 @@ function ps.hasItems(items) end return true end + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/jpr/server/jpr.lua b/bridge/inventory/jpr/server/jpr.lua index 958be9d..c315f48 100644 --- a/bridge/inventory/jpr/server/jpr.lua +++ b/bridge/inventory/jpr/server/jpr.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: JPR Inventory') function ps.removeItem(identifier, item, amount, slot, reason) if not identifier or not item then return end if not amount then amount = 1 end @@ -108,4 +108,19 @@ function ps.craftItem(source, recipe) end end return true -end \ No newline at end of file +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) diff --git a/bridge/inventory/lj/client/lj.lua b/bridge/inventory/lj/client/lj.lua index 0e7c988..024f428 100644 --- a/bridge/inventory/lj/client/lj.lua +++ b/bridge/inventory/lj/client/lj.lua @@ -1,3 +1,4 @@ +ps.success('Inventory Module Loaded: LJ Inventory') RegisterNetEvent('lj-inventory:client:openInventoryBackWards', function(name, data) TriggerEvent("inventory:client:SetCurrentStash", name) TriggerServerEvent("inventory:server:OpenInventory", "stash", name, { @@ -64,4 +65,9 @@ RegisterNetEvent('ps_lib:client:createShop', function(shopData) if not shopData.slots then shopData.slots = 50 end if not shopData.maxweight then shopData.maxweight = 100000 end TriggerServerEvent("inventory:server:OpenInventory", "shop", "Shop"..math.random(1, 99), shopData) -end) \ No newline at end of file +end) + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/ox/client/ox.lua b/bridge/inventory/ox/client/ox.lua index 8cdf689..e6c47f1 100644 --- a/bridge/inventory/ox/client/ox.lua +++ b/bridge/inventory/ox/client/ox.lua @@ -1,3 +1,4 @@ +ps.success('Inventory Module Loaded: OX Inventory') RegisterNetEvent('ps_lib:client:openInventory', function(name) exports.ox_inventory:openInventory('stash', name) end) @@ -54,4 +55,9 @@ end RegisterNetEvent('ps_lib:client:createShop', function(shopData) if not shopData then shopData.name = 'Shop' end exports.ox_inventory:openInventory('shop', { type = shopData, id = shopData }) -end) \ No newline at end of file +end) + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/ox/server/ox.lua b/bridge/inventory/ox/server/ox.lua index 44a2423..ebde191 100644 --- a/bridge/inventory/ox/server/ox.lua +++ b/bridge/inventory/ox/server/ox.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: OX Inventory') local function CanCarryItem(source, item, amount) if not source or not item then return end if not amount then amount = 1 end @@ -117,4 +117,19 @@ function ps.craftItem(source, recipe) end end return true -end \ No newline at end of file +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) \ No newline at end of file diff --git a/bridge/inventory/ps/client/ps.lua b/bridge/inventory/ps/client/ps.lua index 8abf394..9a7b4c2 100644 --- a/bridge/inventory/ps/client/ps.lua +++ b/bridge/inventory/ps/client/ps.lua @@ -1,3 +1,4 @@ +ps.success('Inventory Module Loaded: PS Inventory') function ps.getImage(item) local itemData = QBCore.Shared.Items[item].image if itemData then @@ -41,4 +42,9 @@ function ps.getItemCount(item) end end return amount -end \ No newline at end of file +end + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/ps/server/ps.lua b/bridge/inventory/ps/server/ps.lua index f4c4b0a..533a6ab 100644 --- a/bridge/inventory/ps/server/ps.lua +++ b/bridge/inventory/ps/server/ps.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: PS Inventory') function ps.removeItem(identifier, item, amount, slot, reason) if not identifier or not item then return end @@ -127,4 +127,19 @@ function ps.craftItem(source, recipe) end return true -end \ No newline at end of file +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) \ No newline at end of file diff --git a/bridge/inventory/qb/client/qb.lua b/bridge/inventory/qb/client/qb.lua index 9096855..6983eb2 100644 --- a/bridge/inventory/qb/client/qb.lua +++ b/bridge/inventory/qb/client/qb.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: QB Inventory') --@param item string -- @return string @@ -56,4 +56,8 @@ function ps.getItemCount(item) end end return amount -end \ No newline at end of file +end +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/qb/server/qb.lua b/bridge/inventory/qb/server/qb.lua index 2716298..758f176 100644 --- a/bridge/inventory/qb/server/qb.lua +++ b/bridge/inventory/qb/server/qb.lua @@ -1,4 +1,4 @@ - +ps.success('Inventory Module Loaded: QB Inventory') -- @param identifier number|string i.e. source or CitizenID -- @param item string -- @param amount number @@ -174,4 +174,19 @@ function ps.craftItem(source, recipe) end end return true -end \ No newline at end of file +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) \ No newline at end of file diff --git a/bridge/inventory/tgiann/client/tgg.lua b/bridge/inventory/tgiann/client/tgg.lua new file mode 100644 index 0000000..ecb5001 --- /dev/null +++ b/bridge/inventory/tgiann/client/tgg.lua @@ -0,0 +1,60 @@ +ps.success('Inventory Module Loaded: TGiann Inventory') + +--@param item string +-- @return string +-- example: ps.getImage('bread') +function ps.getImage(item) + local itemData = exports["tgiann-inventory"]:Items() + itemData = itemData[item] + + if itemData then + return 'nui://tgg-inventory/html/images/' .. itemData.image + else + return 'https://avatars.githubusercontent.com/u/99291234?s=280&v=4' + end +end +-- @param item string +-- @return string +-- example: ps.getLabel('bread') +function ps.getLabel(item) + local itemData = exports["tgiann-inventory"]:GetItemLabel(item) + if itemData then + return itemData + else + return 'Missing Item' + end +end + +--param item string +--param amount number +-- @return boolean +-- example: ps.hasItem('bread', 1) +function ps.hasItem(item, amount) + if not item then return false end + if not amount then amount = 1 end + + return exports["tgiann-inventory"]:HasItem(item, amount) +end + +--@param items table +--@return boolean +-- example: ps.hasItems({['bread'] = 1, ['water'] = 2}) +function ps.hasItems(items) + if not items then return false end + for k, v in pairs(items) do + if not ps.hasItem(k, v) then + return false + end + end + return true +end + +function ps.getItemCount(item) + if not item then return end + return exports["tgiann-inventory"]:GetItemCount(item, nil, nil) +end + +exports('getImage', ps.getImage) +exports('getLabel', ps.getLabel) +exports('hasItem', ps.hasItem) +exports('hasItems', ps.hasItems) diff --git a/bridge/inventory/tgiann/server/tgg.lua b/bridge/inventory/tgiann/server/tgg.lua new file mode 100644 index 0000000..4bf6363 --- /dev/null +++ b/bridge/inventory/tgiann/server/tgg.lua @@ -0,0 +1,190 @@ +ps.success('Inventory Module Loaded: TGiann Inventory') +-- @param identifier number|string i.e. source or CitizenID +-- @param item string +-- @param amount number +-- @param slot number|boolean i.e. false for auto slot ** optional +-- @param reason string ** optional +-- @return boolean +-- example: ps.removeItem(source, 'bread', 1, false, 'ps_lib Remove Item') +function ps.removeItem(identifier, item, amount, slot, reason) + if not identifier or not item then return end + if not amount then amount = 1 end + if not slot then slot = false end + if not reason then reason = 'ps_lib Remove Item' end + if exports['tgiann-inventory']:RemoveItem(identifier, item, amount, slot) then + return true + end + return false +end + + +-- @param identifier number|string i.e. source or CitizenID +-- @param item string +-- @param amount number +-- @param meta table ** optional +-- @param slot number|boolean i.e. false for auto slot ** optional +-- @param reason string ** optional +-- @return boolean +-- example: ps.addItem(source, 'bread', 1, {quality = 100}, false, 'ps_lib Add Item') +function ps.addItem(identifier, item, amount,meta, slot) + if not identifier or not item then return end + if not amount then amount = 1 end + if exports['tgiann-inventory']:AddItem(identifier, item, amount, slot, meta) then + return true + end + return false +end + + +-- @param source number|string i.e. source or CitizenID +-- @param identifier string i.e. stash name +-- @param data table i.e. {label = 'Stash', maxweight = 100000, slots = 50} ** optional +-- example: ps.openStash(source, 'my_stash', {label = 'My Stash', maxweight = 100000, slots = 50}) +function ps.openStash(source, identifier, data) + if not data.label then data.label = identifier end + if not data.maxweight then data.maxweight = 100000 end + if not data.slots then data.slots = 50 end + data.maxWeight = data.maxweight -- tgiann uses maxWeight + exports["tgiann-inventory"]:RegisterStash(data.label, data.label, data.slots, data.maxweight) + exports["tgiann-inventory"]:OpenInventory(source,'stash', data.label, data) +end + +-- @param identifier number|string i.e. source or CitizenID +-- @param item string +-- @param amount number +-- @return boolean +-- example: ps.hasItem(source, 'bread', 1) +function ps.hasItem(identifier, item, amount) + if not identifier or not item then return end + if not amount then amount = 1 end + return exports["tgiann-inventory"]:HasItem(identifier, item, amount) +end + +-- @param identifier number|string i.e. source +-- @return number +-- example: ps.getFreeWeight(source) +function ps.getFreeWeight(identifier) + if not identifier then return end + return exports["tgiann-inventory"]:GetFreeWeight(identifier) +end + +-- @param source number|string i.e. source +-- @param playerid number|string i.e. target player id or CitizenID +function ps.openInventoryById(source, playerid) + exports["tgiann-inventory"]:OpenInventoryById(source, playerid,false) +end + +-- @param source number|string i.e. source +-- @param identifier string i.e. Target Players CitizenID + +function ps.clearInventory(source, identifier) + if not identifier then return end + exports["tgiann-inventory"]:ClearInventory(identifier) +end + + +-- @param source number|string i.e. source +-- @param identifier string i.e. Stash Name +-- example: ps.clearStash(source, 'my_stash') +function ps.clearStash(source, identifier) + ps.warn("clearStash is not supported in tgiann-inventory") +end + + +-- @param identifier number|string i.e. source +-- @param item string +-- @return number +-- example: ps.getItemCount(identifier, 'bread') +function ps.getItemCount(identifier, item) + if not identifier or not item then return end + return exports["tgiann-inventory"]:GetItemCount(identifier, item) +end + +-- @param identifier number|string i.e. source +-- @param item string +-- @return table|nil +-- example: ps.getItemByName(identifier, 'bread') +function ps.getItemByName(identifier, item) + if not identifier or not item then return end + return exports["tgiann-inventory"]:GetItemByName(identifier, item) +end + +-- @param identifier number|string i.e. source +-- @param items table i.e. {'bread', 'water'} +-- @return table|nil +-- example: ps.getItemsByNames(identifier, {'bread', 'water'}) + +function ps.getItemsByNames(identifier, items) + if not identifier or not items then return end + local itemList = {} + for _, item in ipairs(items) do + local itemData = exports["tgiann-inventory"]:GetItemByName(identifier, item) + if itemData then + itemList[item] = itemData + end + end + return itemList +end + +-- @param source number|string i.e. source +-- @param shopData table i.e. {name = 'Shop', items = {}, slots = 10, label = 'Shop'} +-- example: ps.createShop(source, {name = 'Shop', items = {}, slots = 10, label = 'Shop'}) +function ps.createShop(source, shopData) + if not shopData.name then shopData.name = 'Shop' end + if not shopData.items then shopData.items = {} end + if not shopData.slots then shopData.slots = #shopData.items end + if not shopData.label then shopData.label = shopData.name end + exports["tgiann-inventory"]:RegisterShop(shopData.name, shopData.items) + exports["tgiann-inventory"]:OpenShop(source, shopData.name) +end + +-- @param source number|string i.e. source +-- @param recipe table i.e. {take = {bread = 1, water = 1}, give = {sandwich = 1}} +function ps.verifyRecipe(source, recipe) + local need, have = 0,0 + for k, v in pairs (recipe) do + if ps.getItemCount(source, k) >= v then + have = have + 1 + end + need = need + 1 + end + return have >= need +end + +-- @param source number|string i.e. source +-- @param recipe table i.e. {take = {bread = 1, water = 1}, give = {sandwich = 1}} +-- @return boolean +-- example: ps.craftItem(source, {take = {bread = 1, water = 1}, give = {sandwich = 1}}) +function ps.craftItem(source, recipe) + local src = source + local itemChecks = ps.verifyRecipe(src, recipe.take) + if not itemChecks then return false end + for k, v in pairs(recipe.take) do + if not ps.removeItem(src, k, v) then + ps.notify(src, ps.lang("noItem", v, k), "error") + return false + end + end + for k, v in pairs(recipe.give) do + if not ps.addItem(src, k, v) then + ps.notify(src, ps.lang("noItem", v, k), "error") + return false + end + end + return true +end + +exports('removeItem', ps.removeItem) +exports('addItem', ps.addItem) +exports('openStash', ps.openStash) +exports('hasItem', ps.hasItem) +exports('getFreeWeight', ps.getFreeWeight) +exports('openInventoryById', ps.openInventoryById) +exports('clearInventory', ps.clearInventory) +exports('clearStash', ps.clearStash) +exports('getItemCount', ps.getItemCount) +exports('getItemByName', ps.getItemByName) +exports('getItemsByNames', ps.getItemsByNames) +exports('createShop', ps.createShop) +exports('verifyRecipe', ps.verifyRecipe) +exports('craftItem', ps.craftItem) \ No newline at end of file diff --git a/bridge/menus/lation.lua b/bridge/menus/lation.lua new file mode 100644 index 0000000..9459071 --- /dev/null +++ b/bridge/menus/lation.lua @@ -0,0 +1,67 @@ +ps.success('Menu Module Loaded: Lation UI') + +function ps.menu(name, label, data) + local options = {} + for k, v in pairs (data or {}) do + local serverEvent, event = nil, nil + if v.isServer then + serverEvent = v.event + else + event = v.event + end + options[k] = { + title = v.title or '', + description = v.description or '', + icon = v.icon or nil, + disabled = v.disabled or nil, + onSelect = v.action or nil, + event = event, + args = v.args or nil, + serverEvent = serverEvent + } + end + exports.lation_ui:registerMenu({ + id = name, + title = label or 'Context Menu', + options = options, + }) + exports.lation_ui:showMenu(name) +end + +function ps.closeMenu() + exports.lation_ui:hideMenu() +end + +function ps.input(label, data) + local options = {} + + for k, v in pairs(data or {}) do + if v.type == 'text' then + v.type = 'input' + end + options[k] = { + label = v.title or nil, + type = v.type or 'input', + description = v.description or nil, + placeholder = v.placeholder or nil, + options = v.options or nil, + required = v.required or false, + min = v.min or nil, + max = v.max or nil, + } + end + + local result = exports.lation_ui:input({ + title = label, + options = options + }) + if result and result[1] then + return result + else + return nil + end +end + +exports('menu', ps.menu) +exports('closeMenu', ps.closeMenu) +exports('input', ps.input) \ No newline at end of file diff --git a/bridge/menus/ox.lua b/bridge/menus/ox.lua index b8b14f2..7465b18 100644 --- a/bridge/menus/ox.lua +++ b/bridge/menus/ox.lua @@ -1,4 +1,4 @@ - +ps.success('Menu Module Loaded: ox_lib') function ps.menu(name, label, data) local options = {} @@ -57,4 +57,7 @@ function ps.input(label, data) else return nil end -end \ No newline at end of file +end +exports('menu', ps.menu) +exports('closeMenu', ps.closeMenu) +exports('input', ps.input) \ No newline at end of file diff --git a/bridge/menus/ps.lua b/bridge/menus/ps.lua index 95ac424..7aff1fb 100644 --- a/bridge/menus/ps.lua +++ b/bridge/menus/ps.lua @@ -1,4 +1,4 @@ - +ps.success('Menu Module Loaded: PS-UI') function ps.menu(name, label, data) local options = {} @@ -52,4 +52,7 @@ function ps.input(label, data) else return nil end -end \ No newline at end of file +end +exports('menu', ps.menu) +exports('closeMenu', ps.closeMenu) +exports('input', ps.input) \ No newline at end of file diff --git a/bridge/menus/qb.lua b/bridge/menus/qb.lua index 5d3fca3..5338e80 100644 --- a/bridge/menus/qb.lua +++ b/bridge/menus/qb.lua @@ -1,4 +1,4 @@ - +ps.success('Menu Module Loaded: QB Menu') function ps.menu(name, label, data) local options = {} @@ -55,4 +55,7 @@ function ps.input(label, data) else return nil end -end \ No newline at end of file +end +exports('menu', ps.menu) +exports('closeMenu', ps.closeMenu) +exports('input', ps.input) \ No newline at end of file diff --git a/bridge/notify/client/esx.lua b/bridge/notify/client/esx.lua index 9c526d6..f63f679 100644 --- a/bridge/notify/client/esx.lua +++ b/bridge/notify/client/esx.lua @@ -1,6 +1,8 @@ +ps.success('Notification Module Loaded: ESX Notify') function ps.notify( text, type, time) if not text then return end if not type then type = 'info' end if not time then time = 5000 end ESX.ShowNotification(text, type, time, "Notification", "top-left") -end \ No newline at end of file +end +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/lation.lua b/bridge/notify/client/lation.lua new file mode 100644 index 0000000..74e6e27 --- /dev/null +++ b/bridge/notify/client/lation.lua @@ -0,0 +1,17 @@ +ps.success('Notification Module Loaded: Lation UI') +function ps.notify(text, type, time) + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + exports.lation_ui:notify({ + message = text, + type = type, + duration = time + }) +end + +RegisterNetEvent('ps_lib:notify:lation', function(data) + ps.notify(data.message, data.type, data.duration) +end) + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/mad_thoughts.lua b/bridge/notify/client/mad_thoughts.lua index cb5b1b4..f5da171 100644 --- a/bridge/notify/client/mad_thoughts.lua +++ b/bridge/notify/client/mad_thoughts.lua @@ -1,3 +1,6 @@ +ps.success('Notification Module Loaded: Mad Thoughts') + + --- IGNORE --- function ps.notify(text, type, time) if not text then return end if not type then type = 'info' end @@ -11,4 +14,6 @@ function ps.notify(text, type, time) elseif type == 'warning' then exports['mad-thoughts']:warning(text, time / 1000) end -end \ No newline at end of file +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/okok.lua b/bridge/notify/client/okok.lua new file mode 100644 index 0000000..8c8c781 --- /dev/null +++ b/bridge/notify/client/okok.lua @@ -0,0 +1,9 @@ +ps.success('Notification Module Loaded: okok Notify') +function ps.notify(text, type, time) + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + exports['okokNotify']:Alert('',text, time, type, false) +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/ox.lua b/bridge/notify/client/ox.lua index 3ec6f85..1e7ea9b 100644 --- a/bridge/notify/client/ox.lua +++ b/bridge/notify/client/ox.lua @@ -1,3 +1,4 @@ +ps.success('Notification Module Loaded: ox_lib Notify') function ps.notify(text, type, time) if not text then return end if not type then type = 'info' end @@ -7,4 +8,6 @@ function ps.notify(text, type, time) type = type, duration = time, }) -end \ No newline at end of file +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/paradise.lua b/bridge/notify/client/paradise.lua new file mode 100644 index 0000000..ce4980b --- /dev/null +++ b/bridge/notify/client/paradise.lua @@ -0,0 +1,13 @@ +ps.success('Notification Module Loaded: Paradise Notify') +function ps.notify(text, type, time) + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + exports['paradise_notify']:ShowNotification({ + description = text, + type = type, + duration = time, +}) +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/ps.lua b/bridge/notify/client/ps.lua index c20d8e2..e79afc0 100644 --- a/bridge/notify/client/ps.lua +++ b/bridge/notify/client/ps.lua @@ -1,6 +1,9 @@ +ps.success('Notification Module Loaded: PS-UI') function ps.notify(text, type, time) if not text then return end if not type then type = 'info' end if not time then time = 5000 end exports['ps_lib']:notify(text, type, time) -end \ No newline at end of file +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/client/qb.lua b/bridge/notify/client/qb.lua index d6aeb41..69b71a7 100644 --- a/bridge/notify/client/qb.lua +++ b/bridge/notify/client/qb.lua @@ -1,7 +1,9 @@ - +ps.success('Notification Module Loaded: QB Notify') function ps.notify(text, type, time) if not text then return end if not type then type = 'info' end if not time then time = 5000 end QBCore.Functions.Notify(text, type, time) -end \ No newline at end of file +end + +exports('notify', ps.notify) \ No newline at end of file diff --git a/bridge/notify/server/esx.lua b/bridge/notify/server/esx.lua index ba52b28..b97d1db 100644 --- a/bridge/notify/server/esx.lua +++ b/bridge/notify/server/esx.lua @@ -1,7 +1,10 @@ +ps.success('Notification Module Loaded: ESX Notify') function ps.notify(source, text, type, time) if not source then return end if not text then return end if not type then type = 'info' end if not time then time = 5000 end TriggerClientEvent('esx:showNotification', source, text, type, time) -end \ No newline at end of file +end + +exports('notify', ps.notify) diff --git a/bridge/notify/server/lation.lua b/bridge/notify/server/lation.lua new file mode 100644 index 0000000..c6af6d5 --- /dev/null +++ b/bridge/notify/server/lation.lua @@ -0,0 +1,14 @@ +function ps.notify(source, text, type, time) + if not source then return end + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + TriggerClientEvent('ps_lib:notify:lation', source, { + description = text, + type = type, + duration = time, + }) +end + +exports('notify', ps.notify) +ps.success('Notification Module Loaded: Lation UI') \ No newline at end of file diff --git a/bridge/notify/server/mad_thoughts.lua b/bridge/notify/server/mad_thoughts.lua index 7a91e9c..14ad3a0 100644 --- a/bridge/notify/server/mad_thoughts.lua +++ b/bridge/notify/server/mad_thoughts.lua @@ -12,4 +12,6 @@ function ps.notify(source, text, type, time) elseif type == 'warning' then exports['mad-thoughts']:warning(source, text, time / 1000) end -end \ No newline at end of file +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: Mad Thoughts') \ No newline at end of file diff --git a/bridge/notify/server/okok.lua b/bridge/notify/server/okok.lua new file mode 100644 index 0000000..1fdb857 --- /dev/null +++ b/bridge/notify/server/okok.lua @@ -0,0 +1,10 @@ + +function ps.notify(src, text, type, time) + if not src then return end + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + TriggerClientEvent('okokNotify:Alert', src, '', text, time, type, false) +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: okok Notify') \ No newline at end of file diff --git a/bridge/notify/server/ox.lua b/bridge/notify/server/ox.lua index b377c8e..80819ee 100644 --- a/bridge/notify/server/ox.lua +++ b/bridge/notify/server/ox.lua @@ -8,4 +8,6 @@ function ps.notify(source, text, type, time) type = type, duration = time, }) -end \ No newline at end of file +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: ox_lib Notify') \ No newline at end of file diff --git a/bridge/notify/server/paradise.lua b/bridge/notify/server/paradise.lua new file mode 100644 index 0000000..5daaf17 --- /dev/null +++ b/bridge/notify/server/paradise.lua @@ -0,0 +1,13 @@ +function ps.notify(source, text, type, time) + if not source then return end + if not text then return end + if not type then type = 'info' end + if not time then time = 5000 end + exports['paradise_notify']:ShowNotification(source, { + description = text, + type = type, + duration = time + }) +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: Paradise Notify') \ No newline at end of file diff --git a/bridge/notify/server/ps.lua b/bridge/notify/server/ps.lua index 2d22261..41e9d5c 100644 --- a/bridge/notify/server/ps.lua +++ b/bridge/notify/server/ps.lua @@ -4,4 +4,6 @@ function ps.notify(source, text, type, time) if not type then type = 'info' end if not time then time = 5000 end TriggerClientEvent('ps_lib:notify', source, text, type, time) -end \ No newline at end of file +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: PS-UI') \ No newline at end of file diff --git a/bridge/notify/server/qb.lua b/bridge/notify/server/qb.lua index 2a75e97..4ff62d2 100644 --- a/bridge/notify/server/qb.lua +++ b/bridge/notify/server/qb.lua @@ -4,4 +4,6 @@ function ps.notify(source, text, type, time) if not type then type = 'info' end if not time then time = 5000 end TriggerClientEvent('QBCore:Notify', source, text, type, time) -end \ No newline at end of file +end +exports('notify', ps.notify) +ps.success('Notification Module Loaded: QB Notify') \ No newline at end of file diff --git a/bridge/progressbars/keep.lua b/bridge/progressbars/keep.lua index 0760895..173855f 100644 --- a/bridge/progressbars/keep.lua +++ b/bridge/progressbars/keep.lua @@ -1,5 +1,5 @@ local p = nil - +ps.success('Progressbar Module Loaded: keep-progressbar') local function handleDisable(disabled) if disabled.movement == nil then disabled.movement = Config.Progressbar.Movement @@ -37,9 +37,13 @@ function ps.progressbar(text, time, emote, disabled) ps.cancelEmote() if not cancelled then p:resolve(true) + p = nil else p:resolve(false) + p = nil end end) return Citizen.Await(p) -end \ No newline at end of file +end + +exports('progressbar', ps.progressbar) \ No newline at end of file diff --git a/bridge/progressbars/lation.lua b/bridge/progressbars/lation.lua new file mode 100644 index 0000000..06fd1bf --- /dev/null +++ b/bridge/progressbars/lation.lua @@ -0,0 +1,45 @@ +ps.success('Progressbar Module Loaded: Lation UI') +local function handleDisable(disabled) + if disabled.movement == nil then + disabled.movement = Config.Progressbar.Movement + end + if disabled.car == nil then + disabled.car = Config.Progressbar.CarMovement + end + if disabled.mouse == nil then + disabled.mouse = Config.Progressbar.Mouse + end + if disabled.combat == nil then + disabled.combat = Config.Progressbar.Combat + end + return disabled +end + +function ps.progressbar(text, time, emote, disabled) + disabled = handleDisable(disabled or {}) + if emote then + ps.playEmote(emote) + end + local data = { + duration = time, + label = text, + useWhileDead = false, + canCancel = true, + disable = { + car = disabled.car, + move = disabled.movement, + mouse = disabled.mouse, + combat = disabled.combat, + }, + } + if exports.lation_ui:progressBar(data) then + ps.cancelEmote() + return true + else + ps.cancelEmote() + return false + end +end + + +exports('progressbar', ps.progressbar) \ No newline at end of file diff --git a/bridge/progressbars/oxbar.lua b/bridge/progressbars/oxbar.lua index 3ba0ee0..84128d5 100644 --- a/bridge/progressbars/oxbar.lua +++ b/bridge/progressbars/oxbar.lua @@ -39,4 +39,9 @@ function ps.progressbar(text, time, emote, disabled) ps.cancelEmote() return false end -end \ No newline at end of file +end + + +exports('progressbar', ps.progressbar) + +ps.success('Progressbar Module Loaded: ox_lib Progressbar') \ No newline at end of file diff --git a/bridge/progressbars/oxcircle.lua b/bridge/progressbars/oxcircle.lua index f206b2f..b40d3ca 100644 --- a/bridge/progressbars/oxcircle.lua +++ b/bridge/progressbars/oxcircle.lua @@ -40,4 +40,8 @@ function ps.progressbar(text, time, emote, disabled) ps.cancelEmote() return false end -end \ No newline at end of file +end + + +exports('progressbar', ps.progressbar) +ps.success('Progressbar Module Loaded: ox_lib OX Circle Progressbar') \ No newline at end of file diff --git a/bridge/progressbars/qb.lua b/bridge/progressbars/qb.lua index 83e0f6c..fa50df9 100644 --- a/bridge/progressbars/qb.lua +++ b/bridge/progressbars/qb.lua @@ -38,4 +38,8 @@ function ps.progressbar(text, time, emote, disabled) ps.cancelEmote() end) return Citizen.Await(p) -end \ No newline at end of file +end + + +exports('progressbar', ps.progressbar) +ps.success('Progressbar Module Loaded: QB Progressbar') \ No newline at end of file diff --git a/bridge/server.lua b/bridge/server.lua index 719d9ff..410128f 100644 --- a/bridge/server.lua +++ b/bridge/server.lua @@ -10,6 +10,7 @@ local inventoryResources = { ['lj-inventory'] = 'bridge/inventory/lj/server/lj.lua', ['ps-inventory'] = 'bridge/inventory/ps/server/ps.lua', ['jpr-inventory'] = 'bridge/inventory/jpr/server/jpr.lua', + ['tgiann-inventory'] = 'bridge/inventory/tgiann/server/tgg.lua', } local notify = { @@ -20,53 +21,65 @@ local notify = { ['mad_thoughts'] = 'server/mad_thoughts.lua', } -if notify[Config.Notify] then - loadLib('bridge/notify/'..notify[Config.Notify]) - ps.success(('Notify system loaded: %s'):format(Config.Notify)) -end +local banking = { + ['qb'] = 'bridge/banking/qb/server.lua', + ['okok'] = 'bridge/banking/okok/server.lua', + ['Renewed'] = 'bridge/banking/Renewed/server.lua', +} local function loadFramework() for key, data in ipairs(frameworkResources) do if GetResourceState(data.name) == 'started' then loadLib(data.path) - framework = data.name + inventory = data.name ps.success(('Framework resource found: %s'):format(data.name)) break end end - if not framework then + if not inventory then loadLib('bridge/framework/custom/client.lua') ps.warn('No framework resource found: falling back to custom') end end -loadFramework() - local function loadInventory() + local inside = false for script, path in pairs(inventoryResources) do if GetResourceState(script) == 'started' then loadLib(path) - inventory = script - ps.success(('Inventory resource found: %s'):format(script)) + inside = true break end end - if not inventory then + if not inside then loadLib('bridge/inventory/custom/server/custom.lua') ps.warn('No inventory resource found: falling back to custom') end end -loadInventory() +function ps.getFramework() + return framework +end -AddEventHandler('onResourceStart', function(resourceName) - if inventoryResources[resourceName] then - loadLib(inventoryResources[resourceName]) - ps.success(('Inventory resource started: %s'):format(resourceName)) +local function loadAll() + if Config.Inventory ~= 'auto' then + if inventoryResources[Config.Inventory] then + loadLib(inventoryResources[Config.Inventory]) + else + loadLib('bridge/inventory/custom/server/custom.lua') + ps.warn('No inventory resource found: falling back to custom') + end + else + loadInventory() + end + if notify[Config.Notify] then + loadLib('bridge/notify/'..notify[Config.Notify]) end -end) -function ps.getFramework() - return framework -end \ No newline at end of file + if banking[Config.Banking] then + loadLib(banking[Config.Banking]) + end + loadFramework() +end +loadAll() \ No newline at end of file diff --git a/bridge/target/interact/client.lua b/bridge/target/interact/client.lua index cf80d34..e7343eb 100644 --- a/bridge/target/interact/client.lua +++ b/bridge/target/interact/client.lua @@ -132,4 +132,12 @@ AddEventHandler('onResourceStop', function(resourceName) end zones[resourceName] = nil end -end) \ No newline at end of file +end) + +exports('boxTarget', ps.boxTarget) +exports('circleTarget', ps.circleTarget) +exports('entityTarget', ps.entityTarget) +exports('targetModel', ps.targetModel) +exports('destroyAllTargets', ps.destroyAllTargets) +exports('destroyTarget', ps.destroyTarget) +ps.success('Target Module Loaded: Interact Target') \ No newline at end of file diff --git a/bridge/target/ox/client.lua b/bridge/target/ox/client.lua index 89a3509..92403f4 100644 --- a/bridge/target/ox/client.lua +++ b/bridge/target/ox/client.lua @@ -123,4 +123,12 @@ AddEventHandler('onResourceStop', function(resourceName) end zones[resourceName] = nil end -end) \ No newline at end of file +end) + +exports('boxTarget', ps.boxTarget) +exports('circleTarget', ps.circleTarget) +exports('entityTarget', ps.entityTarget) +exports('targetModel', ps.targetModel) +exports('destroyAllTargets', ps.destroyAllTargets) +exports('destroyTarget', ps.destroyTarget) +ps.success('Target Module Loaded: ox_target') \ No newline at end of file diff --git a/bridge/target/qb/client.lua b/bridge/target/qb/client.lua index da53614..7fa02f1 100644 --- a/bridge/target/qb/client.lua +++ b/bridge/target/qb/client.lua @@ -131,4 +131,12 @@ AddEventHandler('onResourceStop', function(resourceName) end zones[resourceName] = nil end -end) \ No newline at end of file +end) + +exports('boxTarget', ps.boxTarget) +exports('circleTarget', ps.circleTarget) +exports('entityTarget', ps.entityTarget) +exports('targetModel', ps.targetModel) +exports('destroyAllTargets', ps.destroyAllTargets) +exports('destroyTarget', ps.destroyTarget) +ps.success('Target Module Loaded: QB Target') \ No newline at end of file diff --git a/bridge/vehiclekeys/mrnewb/client/client.lua b/bridge/vehiclekeys/mrnewb/client/client.lua new file mode 100644 index 0000000..edd23c4 --- /dev/null +++ b/bridge/vehiclekeys/mrnewb/client/client.lua @@ -0,0 +1,16 @@ + +function ps.giveVehicleKey(vehicle) + if not vehicle then + return false + end + exports.MrNewbVehicleKeys:GiveKeys(vehicle) +end + +function ps.removeVehicleKey(vehicle) + if not vehicle then + return false + end + exports.MrNewbVehicleKeys:RemoveKeys(vehicle) +end + +ps.success('Vehicle Keys Module Loaded: MrNewb Vehicle Keys') \ No newline at end of file diff --git a/bridge/vehiclekeys/qb/client/client.lua b/bridge/vehiclekeys/qb/client/client.lua new file mode 100644 index 0000000..8f5965b --- /dev/null +++ b/bridge/vehiclekeys/qb/client/client.lua @@ -0,0 +1,16 @@ + +function ps.giveVehicleKey(vehicle) + if not vehicle then + return false + end + TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', QBCore.Functions.GetPlate(vehicle)) +end + +function ps.removeVehicleKey(vehicle) + if not vehicle then + return false + end + TriggerEvent('qb-vehiclekeys:client:RemoveKeys', QBCore.Functions.GetPlate(vehicle)) +end + +ps.success('Vehicle Keys Module Loaded: MrNewb Vehicle Keys') \ No newline at end of file diff --git a/bridge/zones/PolyZone/client.lua b/bridge/zones/PolyZone/client.lua index a96923a..9802939 100644 --- a/bridge/zones/PolyZone/client.lua +++ b/bridge/zones/PolyZone/client.lua @@ -145,4 +145,11 @@ RegisterNetEvent('onResourceStop', function(resourceName) end zones[resourceName] = nil end -end) \ No newline at end of file +end) + +exports('boxZone', ps.zones.box) +exports('sphereZone', ps.zones.sphere) +exports('polyZone', ps.zones.poly) +exports('removeZone', ps.zones.remove) + +ps.success('Zones Module Loaded: ox_lib Zones') \ No newline at end of file diff --git a/bridge/zones/ox/client.lua b/bridge/zones/ox/client.lua index 8a66734..a32f22c 100644 --- a/bridge/zones/ox/client.lua +++ b/bridge/zones/ox/client.lua @@ -50,4 +50,11 @@ RegisterNetEvent('onResourceStop', function(resourceName) end zones[resourceName] = nil end -end) \ No newline at end of file +end) + +exports('boxZone', ps.zones.box) +exports('sphereZone', ps.zones.sphere) +exports('polyZone', ps.zones.poly) +exports('removeZone', ps.zones.remove) + +ps.success('Zones Module Loaded: ox_lib Zones') \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 4d6891f..c58d18d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -29,11 +29,30 @@ Build: 0.5.3 - returns the total amount of the item you send through -Newest Build: 0.5.4 +Build: 0.5.4 - moved a lot to bridge - progressbars, menus, notifications, drawtext, zones - removed ox_grids&Arrays&zones folder from modules - built wrapper for ox zones and PolyZone - fix small ox_inventory bugs for stashes - added support for mad_thoughts and keep_progressbar + +Newest Build: 0.5.5 + - added notification options + - okok, lation, paradise + - added inventory options + - tgg + - added Banking to bridge + - qb-banking, renewed-banking, okok banking + - added Vehicle Keys options + - MrNewb Vehicle Keys, qb + - Added Config Options Config.Inventory, Config.Target + - this allows you to load those modules before the scripts so load order is less + - of an issues + - added exports for most of the functions so you dont need to always load the entire + - lib + - added Lation Menus + - added Lation Draw Text + - added "or 'en'" to the langs global in config in case the native doesnt do it properly + \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 1f5d6f2..caaab10 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,7 +5,7 @@ lua54 'yes' game 'gta5' name 'ps_lib' -version '0.5.4' +version '0.5.5' description 'Project Sloth Library' author 'Project Sloth' diff --git a/modules/animation/animation.lua b/modules/animation/animation.lua index 4d5d9c2..e574c51 100644 --- a/modules/animation/animation.lua +++ b/modules/animation/animation.lua @@ -26,4 +26,6 @@ function ps.playAnim(ped, animDictionary, animationName, blendInSpeed, blendOutS lockZ or false ) RemoveAnimDict(animDictionary) -end \ No newline at end of file +end + +exports('playAnim', ps.playAnim) \ No newline at end of file diff --git a/modules/copyClipboard/client/clipboard.lua b/modules/copyClipboard/client/clipboard.lua index a2a511f..f57ad30 100644 --- a/modules/copyClipboard/client/clipboard.lua +++ b/modules/copyClipboard/client/clipboard.lua @@ -9,4 +9,6 @@ end RegisterCommand('testCopyClipboard', function(source, args, rawCommand) local text = table.concat(args, ' ') ps.copyClipboard(text) -end, false) \ No newline at end of file +end, false) + +exports('copyClipboard', ps.copyClipboard) \ No newline at end of file diff --git a/modules/getNear/client/getNear.lua b/modules/getNear/client/getNear.lua index 3ca097a..8256c55 100644 --- a/modules/getNear/client/getNear.lua +++ b/modules/getNear/client/getNear.lua @@ -22,6 +22,8 @@ function ps.getNearestPed(coords, distance) end end +exports('getNearestPed', ps.getNearestPed) +exports('GetClosestPed', ps.getNearestPed) function ps.getNearestVehicle(coords, distance) if not coords then coords = GetEntityCoords(PlayerPedId()) end if not distance then distance = 10.0 end @@ -45,6 +47,8 @@ function ps.getNearestVehicle(coords, distance) return 'no nearby vehicle', 'no nearby vehicle' end end +exports('getNearestVehicle', ps.getNearestVehicle) +exports('GetClosestVehicle', ps.getNearestVehicle) function ps.getNearestPlayers(coords, distance) local ped = PlayerPedId() @@ -66,7 +70,8 @@ function ps.getNearestPlayers(coords, distance) end return closestPlayer, closestDistance end - +exports('getNearestPlayers', ps.getNearestPlayers) +exports('GetClosestPlayer', ps.getNearestPlayers) function ps.getNearestObject(coords, distance) if not coords then coords = GetEntityCoords(PlayerPedId()) end if not distance then distance = 10.0 end @@ -91,6 +96,9 @@ function ps.getNearestObject(coords, distance) end end +exports('getNearestObject', ps.getNearestObject) +exports('GetClosestObject', ps.getNearestObject) + function ps.getNearestObjectOfType(type, distance, coords) if not type then return end if not coords then coords = GetEntityCoords(PlayerPedId()) end @@ -98,6 +106,9 @@ function ps.getNearestObjectOfType(type, distance, coords) return GetClosestObjectOfType(coords.x, coords.y, coords.z, distance, type, false, false, false) end +exports('getNearestObjectOfType', ps.getNearestObjectOfType) +exports('GetClosestObjectOfType', ps.getNearestObjectOfType) + function ps.getNearbyPed(coords, distance) if not coords then coords = GetEntityCoords(PlayerPedId()) end if not distance then distance = 25.0 end @@ -121,6 +132,7 @@ function ps.getNearbyPed(coords, distance) end end +exports('getNearbyPeds', ps.getNearbyPed) function ps.getNearbyVehicles(coords, distance) if not coords then coords = GetEntityCoords(PlayerPedId()) end if not distance then distance = 25.0 end @@ -143,7 +155,7 @@ function ps.getNearbyVehicles(coords, distance) return {} end end - +exports('getNearbyVehicles', ps.getNearbyVehicles) function ps.getNearbyObjects(coords, distance) if not coords then coords = GetEntityCoords(PlayerPedId()) end if not distance then distance = 25.0 end @@ -165,4 +177,5 @@ function ps.getNearbyObjects(coords, distance) ps.notify('No Objects Nearby', 'error') return {} end -end \ No newline at end of file +end +exports('getNearbyObjects', ps.getNearbyObjects) \ No newline at end of file diff --git a/modules/interactions/client/interactions.lua b/modules/interactions/client/interactions.lua index 0b88c79..449b092 100644 --- a/modules/interactions/client/interactions.lua +++ b/modules/interactions/client/interactions.lua @@ -17,4 +17,6 @@ function ps.minigame(type, values) local success = lib.skillCheck(values.difficulty, values.input) return success end -end \ No newline at end of file +end + +exports('minigame', ps.minigame) \ No newline at end of file diff --git a/modules/keybinds/client/keybinds.lua b/modules/keybinds/client/keybinds.lua index 25d3b43..ae85825 100644 --- a/modules/keybinds/client/keybinds.lua +++ b/modules/keybinds/client/keybinds.lua @@ -25,3 +25,6 @@ function ps.removeKeybind(key) ps.debug('Keybind does not exist') end end + +exports('addKeybind', ps.addKeybind) +exports('removeKeybind', ps.removeKeybind) \ No newline at end of file diff --git a/modules/misc/shared/misc.lua b/modules/misc/shared/misc.lua index 7230d27..51ff356 100644 --- a/modules/misc/shared/misc.lua +++ b/modules/misc/shared/misc.lua @@ -32,3 +32,10 @@ function ps.tableContains(tab, value) end return false end + +exports('sorter', ps.sorter) +exports('concat', ps.concat) +exports('string', ps.string) +exports('decimalRound', ps.decimalRound) +exports('random', ps.random) +exports('tableContains', ps.tableContains) \ No newline at end of file diff --git a/modules/raycast/client/raycast.lua b/modules/raycast/client/raycast.lua index a981df2..91d76d0 100644 --- a/modules/raycast/client/raycast.lua +++ b/modules/raycast/client/raycast.lua @@ -35,3 +35,5 @@ function ps.raycast() local _, hit, endCoords, surfaceNormal, entityHit = RayCastGamePlayCamera(1000.0) return hit, endCoords, surfaceNormal, entityHit end + +exports('raycast', ps.raycast) \ No newline at end of file diff --git a/modules/requests/client/requests.lua b/modules/requests/client/requests.lua index a6c1fa6..c70ef28 100644 --- a/modules/requests/client/requests.lua +++ b/modules/requests/client/requests.lua @@ -41,3 +41,6 @@ function ps.requestPTFX(dict, timeout) return true end +exports('requestModel', ps.requestModel) +exports('requestAnim', ps.requestAnim) +exports('requestPTFX', ps.requestPTFX) \ No newline at end of file diff --git a/modules/streamed_assets/shared/objectList.lua b/modules/streamed_assets/shared/objectList.lua index 4fbf1a1..e2b6598 100644 --- a/modules/streamed_assets/shared/objectList.lua +++ b/modules/streamed_assets/shared/objectList.lua @@ -18463,4 +18463,5 @@ end function ps.getRandomObject() return objectList[math.random(1, #objectList)] -end \ No newline at end of file +end + diff --git a/modules/versionCheck/server/versionCheck.lua b/modules/versionCheck/server/versionCheck.lua index 3d0647c..c728fbb 100644 --- a/modules/versionCheck/server/versionCheck.lua +++ b/modules/versionCheck/server/versionCheck.lua @@ -40,4 +40,6 @@ function ps.versionCheck(script, link, updateLink) end, "GET", "", "") end -- TODO: on release ill need to PR this to get the raw link for version check :) -ps.versionCheck('ps_lib', 'https://raw.githubusercontent.com/Project-Sloth/ps_lib/refs/heads/main/changelog.txt', 'https://github.com/Project-Sloth/ps_lib') \ No newline at end of file +ps.versionCheck('ps_lib', 'https://raw.githubusercontent.com/Project-Sloth/ps_lib/refs/heads/main/changelog.txt', 'https://github.com/Project-Sloth/ps_lib') + +exports('versionCheck', ps.versionCheck) \ No newline at end of file diff --git a/startFirst/shared/_print.lua b/startFirst/shared/_print.lua index f4463c8..e1d6d7d 100644 --- a/startFirst/shared/_print.lua +++ b/startFirst/shared/_print.lua @@ -47,4 +47,10 @@ end function ps.success(...) print('^2[SUCCESS]^0 ' .. formatArgs(...)) -end \ No newline at end of file +end + +exports('debug', ps.debug) +exports('info', ps.info) +exports('error', ps.error) +exports('warn', ps.warn) +exports('success', ps.success) \ No newline at end of file