Documentation, deprecated old points, removed incomplete clothing bridge.

Documentation added, deprecated old points, removed incomplete clothing bridge. I migrated the points into the new system and added deprecation notices. Cleaned some white spaces because they made me unhappy. Added GetStreetNameAtCoords as it may be useful to return a string for others. Added support for lb-tablet dispatch alerts (thank you loaf)
This commit is contained in:
MrNewb committed 2025-04-02 07:27:13 -04:00
1 parent 3e936d2c1c
commit 6bdee6ad91
27 files changed
+276 -411

No files matched your search

+11 -24
View File
@@ -7,30 +7,7 @@ RegisterNetEvent('community_bridge:openShop', function(_type, _title, shopData)
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
---This is an internal event that is used to complete a transaction and offer cash/card pay
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)
@@ -56,6 +33,11 @@ Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
end
---This is an internal event that is used to open the amount select menu
---@param shopName string
---@param item string
---@param itemLabel string
---@param price number
Shops.AmountSelect = function(shopName, item, itemLabel, price)
if not shopName and not item and not itemLabel and not price then return end
local numberOptions = {}
@@ -71,6 +53,11 @@ Shops.AmountSelect = function(shopName, item, itemLabel, price)
end
end
---This will open a shop with the passed title and data. It will create a menu with the items in the shopData table. The items will be clickable and will open a checkout menu.
---This also verifies the shop exsists and was made first server side. This will not work when only used client side and the server side verifies the item exsists in the table as well as the shop id.
---@param title any
---@param shopData any
---@return nil
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()
+19 -2
View File
@@ -2,20 +2,37 @@ Shops = Shops or {}
local registeredShops = {}
---commentThis can open a shop for the client
---@param src number
---@param shopTitle string
---@return boolean
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])
return true
end
---This will create a shop to use on the client side, shops must be registered server side and exsist in the shop inventory table to allow any purchases passed.
---@param shopTitle string
---@param shopInventory table
---@param shopCoords table
---@param shopGroups table
---@return boolean
Shops.CreateShop = function(shopTitle, shopInventory, shopCoords, shopGroups)
if not shopTitle and not shopInventory and not shopCoords then return end
if not shopTitle and not shopInventory and not shopCoords then return false end
if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
return true
end
---This is an internal event to complete a shop transaction, it will verify pass items and amounts are registered to the created shop.
---@param src number
---@param shopName string
---@param item string
---@param amount number
---@param paymentType string
---@return nil
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]