Merge branch 'The-Order-Of-The-Sacred-Framework:dev' into dev

This commit is contained in:
Sky authored and GitHub committed 2025-04-03 09:04:36 +01:00
commit 200d078990
27 files changed
+277 -386

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
-- Objects -- Objects
Utility = Utility or Require("lib/utility/client/utility.lua") Utility = Utility or Require("lib/utility/client/utility.lua")
Ids = Ids or Require("lib/utility/shared/ids.lua") Ids = Ids or Require("lib/utility/shared/ids.lua")
+3 -1
View File
@@ -2,7 +2,9 @@ ItemsBuilder = ItemsBuilder or {}
ItemsBuilder = {} ItemsBuilder = {}
---This will generate the items in the formats of qb_core, qb_core_old and ox_inventory. It will then build a lua file in the generateditems folder of the community_bridge.
---@param invoking string
---@param itemsTable table
ItemsBuilder.Generate = function(invoking, itemsTable) ItemsBuilder.Generate = function(invoking, itemsTable)
if not invoking or not itemsTable then return end if not invoking or not itemsTable then return end
+4
View File
@@ -3,6 +3,10 @@ Logs = Logs or {}
local WebhookURL = "" local WebhookURL = ""
local LogoForEmbed = "" local LogoForEmbed = ""
---This will send a log to the configured webhook or log system.
---@param src number
---@param message string
---@return nil
Logs.Send = function(src, message) Logs.Send = function(src, message)
if not src or not message then return end if not src or not message then return end
if BridgeServerConfig.LogSystem == "builtin" then if BridgeServerConfig.LogSystem == "builtin" then
+101 -29
View File
@@ -1,20 +1,43 @@
Utility = Utility or {} Utility = Utility or {}
local blipIDs = {} local blipIDs = {}
local spawnedPeds = {} local spawnedPeds = {}
local ActivePoints = {}
---commentThis will create a prop with the passed model string at the coords and heading specified optionally networked or not.
---@param model string | number
---@param coords table
---@param heading number
---@param networked boolean
---@return number | nil
Utility.CreateProp = function(model, coords, heading, networked) Utility.CreateProp = function(model, coords, heading, networked)
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return nil, Prints.Error("Model Has Not Loaded") end
local propEntity = CreateObject(model, coords.x, coords.y, coords.z, networked, false, false) local propEntity = CreateObject(model, coords.x, coords.y, coords.z, networked, false, false)
SetEntityHeading(propEntity, heading) SetEntityHeading(propEntity, heading)
SetModelAsNoLongerNeeded(model) SetModelAsNoLongerNeeded(model)
return propEntity return propEntity
end end
---This will get the street name and crossing name at the specified coordinates.
---@param coords table
---@return string
---@return string
Utility.GetStreetNameAtCoords = function(coords)
local streetHash, crossingHash = GetStreetNameAtCoord(coords.x, coords.y, coords.z)
local streetName = GetStreetNameFromHashKey(streetHash)
local crossingName = GetStreetNameFromHashKey(crossingHash)
return streetName, crossingName
end
---This will create a vehicle with the passed model string at the coords and heading specified.
---@param model string
---@param coords table
---@param heading number
---@param networked boolean
---@return number| nil
---@return table
Utility.CreateVehicle = function(model, coords, heading, networked) Utility.CreateVehicle = function(model, coords, heading, networked)
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return nil, {}, Prints.Error("Model Has Not Loaded") end
local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, networked, false) local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z, heading, networked, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true) SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetVehicleNeedsToBeHotwired(vehicle, false) SetVehicleNeedsToBeHotwired(vehicle, false)
@@ -23,15 +46,24 @@ Utility.CreateVehicle = function(model, coords, heading, networked)
return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), } return vehicle, { networkid = NetworkGetNetworkIdFromEntity(vehicle) or 0, coords = GetEntityCoords(vehicle), heading = GetEntityHeading(vehicle), }
end end
---This will create a ped with the passed model string at the coords and heading specified.
---@param model string
---@param coords table
---@param heading number
---@param networked boolean
---@return number| nil
Utility.CreatePed = function(model, coords, heading, networked, settings) Utility.CreatePed = function(model, coords, heading, networked, settings)
Utility.LoadModel(model) Utility.LoadModel(model)
if not HasModelLoaded(model) then return Prints.Error("Model Has Not Loaded") end if not HasModelLoaded(model) then return nil, Prints.Error("Model Has Not Loaded") end
local spawnedEntity = CreatePed(0, model, coords.x, coords.y, coords.z, heading, networked, false) local spawnedEntity = CreatePed(0, model, coords.x, coords.y, coords.z, heading, networked, false)
SetModelAsNoLongerNeeded(model) SetModelAsNoLongerNeeded(model)
table.insert(spawnedPeds, spawnedEntity) table.insert(spawnedPeds, spawnedEntity)
return spawnedEntity return spawnedEntity
end end
---This will display a busy spinner with the passed text.
---@param text string
---@return boolean
Utility.StartBusySpinner = function(text) Utility.StartBusySpinner = function(text)
AddTextEntry(text, text) AddTextEntry(text, text)
BeginTextCommandBusyString(text) BeginTextCommandBusyString(text)
@@ -40,6 +72,8 @@ Utility.StartBusySpinner = function(text)
return true return true
end end
---This will stop a busy spinner if one is currently active.
---@return boolean
Utility.StopBusySpinner = function() Utility.StopBusySpinner = function()
if BusyspinnerIsOn() then if BusyspinnerIsOn() then
BusyspinnerOff() BusyspinnerOff()
@@ -48,6 +82,15 @@ Utility.StopBusySpinner = function()
return false return false
end end
---comment Creates a blip at the specified coordinates with the specified parameters. If sprite/color/scale/label are not provided, default values will be used.
---@param coords table
---@param sprite number
---@param color number
---@param scale number
---@param label string
---@param shortRange boolean
---@param displayType number
---@return integer
Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange, displayType) Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange, displayType)
local blip = AddBlipForCoord(coords.x, coords.y, coords.z) local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, sprite or 8) SetBlipSprite(blip, sprite or 8)
@@ -62,6 +105,9 @@ Utility.CreateBlip = function(coords, sprite, color, scale, label, shortRange, d
return blip return blip
end end
---This will remove a blip if it exists in the blipIDs table.
---@param blip number
---@return boolean
Utility.RemoveBlip = function(blip) Utility.RemoveBlip = function(blip)
local success = false local success = false
for i, storedBlip in ipairs(blipIDs) do for i, storedBlip in ipairs(blipIDs) do
@@ -75,6 +121,9 @@ Utility.RemoveBlip = function(blip)
return success return success
end end
---Loads a model into memory. If the model is not valid or not in the game files, it will return false.
---@param model string | number
---@return boolean
Utility.LoadModel = function(model) Utility.LoadModel = function(model)
if type(model) ~= 'number' then model = joaat(model) end if type(model) ~= 'number' then model = joaat(model) end
if not IsModelValid(model) and not IsModelInCdimage(model) then return false end if not IsModelValid(model) and not IsModelInCdimage(model) then return false end
@@ -87,6 +136,9 @@ Utility.LoadModel = function(model)
return HasModelLoaded(model) return HasModelLoaded(model)
end end
---This function will request an animation dictionary and wait until it is loaded. If the dictionary is not valid, it will return false.
---@param dict string
---@return boolean
Utility.RequestAnimDict = function(dict) Utility.RequestAnimDict = function(dict)
RequestAnimDict(dict) RequestAnimDict(dict)
local count = 0 local count = 0
@@ -97,6 +149,9 @@ Utility.RequestAnimDict = function(dict)
return HasAnimDictLoaded(dict) return HasAnimDictLoaded(dict)
end end
---This will remove a ped if it exists in the spawnedPeds table. It will also delete the entity if it exists.
---@param entity number
---@return boolean
Utility.RemovePed = function(entity) Utility.RemovePed = function(entity)
local success = false local success = false
if DoesEntityExist(entity) then if DoesEntityExist(entity) then
@@ -112,6 +167,10 @@ Utility.RemovePed = function(entity)
return success return success
end end
---This will use a native text input menu to allow the user to enter text. It will return the entered text or false if cancelled.
---@param text string
---@param length number
---@return string
Utility.NativeInputMenu = function(text, length) Utility.NativeInputMenu = function(text, length)
local maxLength = Math.Clamp(length, 1, 50) local maxLength = Math.Clamp(length, 1, 50)
local menutText = text or 'enter text' local menutText = text or 'enter text'
@@ -128,6 +187,9 @@ Utility.NativeInputMenu = function(text, length)
return false return false
end end
---This will get the current skin data of the entity passed. It will return a table with the clothing and props data.
---@param entity number
---@return table
Utility.GetEntitySkinData = function(entity) Utility.GetEntitySkinData = function(entity)
local skinData = {} local skinData = {}
for i = 0, 11 do for i = 0, 11 do
@@ -139,6 +201,10 @@ Utility.GetEntitySkinData = function(entity)
return skinData return skinData
end end
---This will set the skin data of the entity passed. It will set the clothing and props data from the skinData table.
---@param entity number
---@param skinData table
---@return boolean
Utility.SetEntitySkinData = function(entity, skinData) Utility.SetEntitySkinData = function(entity, skinData)
for i = 0, 11 do for i = 0, 11 do
SetPedComponentVariation(entity, i, skinData.clothing[i][1], skinData.clothing[i][2], 0) SetPedComponentVariation(entity, i, skinData.clothing[i][1], skinData.clothing[i][2], 0)
@@ -149,6 +215,8 @@ Utility.SetEntitySkinData = function(entity, skinData)
return true return true
end end
---This will reload the skin data of the entity passed. It will set the clothing and props data from the skinData table and delete any attached objects.
---@return boolean
Utility.ReloadSkin = function() Utility.ReloadSkin = function()
local skinData = Utility.GetEntitySkinData(cache.ped) local skinData = Utility.GetEntitySkinData(cache.ped)
Utility.SetEntitySkinData(cache.ped, skinData) Utility.SetEntitySkinData(cache.ped, skinData)
@@ -162,18 +230,27 @@ Utility.ReloadSkin = function()
return true return true
end end
---This will display a native help text on the screen. It will add a text entry and display it for the specified duration.
---@param text string
---@param duration number
Utility.HelpText = function(text, duration) Utility.HelpText = function(text, duration)
AddTextEntry(text, text) AddTextEntry(text, text)
BeginTextCommandDisplayHelp(text) BeginTextCommandDisplayHelp(text)
EndTextCommandDisplayHelp(0, false, true, duration or 5000) EndTextCommandDisplayHelp(0, false, true, duration or 5000)
end end
---This will display a native help text on the screen. It will add a text entry and display it for the specified duration.
---@param text string
Utility.NotifyText = function(text) Utility.NotifyText = function(text)
AddTextEntry(text, text) AddTextEntry(text, text)
SetNotificationTextEntry(text) SetNotificationTextEntry(text)
DrawNotification(false, true) DrawNotification(false, true)
end end
---This will teleport a player to the specified coordinates. If a condition function is passed it will verify that condition is met and then it will fade the screen out and in, freeze the player during the teleport to allow for collisions to load, and call the afterTeleportFunction if provided.
---@param coords table
---@param conditionFunction function | optional
---@param afterTeleportFunction function | optional
Utility.TeleportPlayer = function(coords, conditionFunction, afterTeleportFunction) Utility.TeleportPlayer = function(coords, conditionFunction, afterTeleportFunction)
if conditionFunction ~= nil then if conditionFunction ~= nil then
if not conditionFunction() then if not conditionFunction() then
@@ -200,11 +277,21 @@ Utility.TeleportPlayer = function(coords, conditionFunction, afterTeleportFuncti
end end
end end
---This will get a model hash from a string or number.
---@param model string | number
---@return number
Utility.GetEntityHashFromModel = function(model) Utility.GetEntityHashFromModel = function(model)
if type(model) ~= 'number' then model = joaat(model) end if type(model) ~= 'number' then model = joaat(model) end
return model return model
end end
---commentThis will get the closest player, the distance to that player from the coords and the server ID of that player.
---@param coords table
---@param distanceScope number
---@param includeMe boolean
---@return integer
---@return integer
---@return integer
Utility.GetClosestPlayer = function(coords, distanceScope, includeMe) Utility.GetClosestPlayer = function(coords, distanceScope, includeMe)
local players = GetActivePlayers() local players = GetActivePlayers()
local closestPlayer = 0 local closestPlayer = 0
@@ -227,7 +314,7 @@ Utility.GetClosestPlayer = function(coords, distanceScope, includeMe)
return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer) return closestPlayer, closestDistance, GetPlayerServerId(closestPlayer)
end end
---This function is used to register a point on the map, functions are fired when in the distance/exiting the area ---This function is is deprecated and will be removed in the future. Please use Pont.Register instead.
---@param pointID string ---@param pointID string
---@param pointCoords table ---@param pointCoords table
---@param pointDistance number ---@param pointDistance number
@@ -235,41 +322,26 @@ end
---@param _onExit function ---@param _onExit function
---@param _nearby function ---@param _nearby function
Utility.RegisterPoint = function(pointID, pointCoords, pointDistance, _onEnter, _onExit, _nearby) Utility.RegisterPoint = function(pointID, pointCoords, pointDistance, _onEnter, _onExit, _nearby)
ActivePoints[pointID] = lib.points.new({ return Point.Register(pointID, pointCoords, pointDistance, nil, _onEnter, _onExit, _nearby)
coords = pointCoords,
distance = pointDistance,
onEnter = function(self)
_onEnter(self)
end,
onExit = function(self)
_onExit(self)
end,
nearby = function(self)
if _nearby then
_nearby(self)
end
end
})
end end
-- Function to retrieve the zone by the pointID ---This function is is deprecated and will be removed in the future. Please use Point.Get instead.
---@param pointID string ---@param pointID string
Utility.GetPointById = function(pointID) Utility.GetPointById = function(pointID)
return ActivePoints[pointID] return Point.Get(pointID)
end end
---This function is is deprecated and will be removed in the future. Please use Point.GetAll instead.
---@return table | nil ---@return table | nil
Utility.GetActivePoints = function() Utility.GetActivePoints = function()
return ActivePoints return Point.GetAll()
end end
---Pass the point ID to remove the point from the map
---This function is is deprecated and will be removed in the future. Please use Point.Remove instead.
---@param pointID string ---@param pointID string
---@return boolean ---@return nil
Utility.RemovePoint = function(pointID) Utility.RemovePoint = function(pointID)
if not ActivePoints[pointID] then return false end return Point.Remove(pointID)
ActivePoints[pointID]:remove()
ActivePoints[pointID] = nil
return true
end end
AddEventHandler('onResourceStop', function(resource) AddEventHandler('onResourceStop', function(resource)
+2
View File
@@ -1,3 +1,5 @@
--[[This module is incomplete]]--
Clothing = Clothing or {} Clothing = Clothing or {}
ClothingBackup = {} ClothingBackup = {}
+2 -2
View File
@@ -1,3 +1,5 @@
--[[This module is incomplete]]--
Clothing = Clothing or {} Clothing = Clothing or {}
Clothing.SetAppearance = function(src, data) Clothing.SetAppearance = function(src, data)
@@ -13,8 +15,6 @@ Clothing.ReloadSkin = function(src)
end end
RegisterNetEvent('community_bridge:client:SetAppearance', function(data) RegisterNetEvent('community_bridge:client:SetAppearance', function(data)
Clothing.SetAppearance(data) Clothing.SetAppearance(data)
end) end)
-142
View File
@@ -1,142 +0,0 @@
if GetResourceState('esx_skin') ~= 'started' then return end
Clothing = Clothing or {}
local clothingData = {
male = {
components = {
face = {component_id = 0, texture = 0, drawable = 2},
mask = {component_id = 1, texture = 0, drawable = 2},
hair = {component_id = 2, texture = 0, drawable = 2},
arms = {component_id = 3, texture = 0, drawable = 2},
pants = {component_id = 4, texture = 0, drawable = 22},
bag = {component_id = 5, texture = 1, drawable = 33},
shoes = {component_id = 6, texture = 1, drawable = 33},
accessory = {component_id = 7, texture = 1, drawable = 33},
shirt = {component_id = 8, texture = 1, drawable = 11},
bodyarmor = {component_id = 9, texture = 1, drawable = 33},
decals = {component_id = 10, texture = 1, drawable = 33},
jacket = {component_id = 11, texture = 2, drawable = 4},
},
props = {
hats = {prop_id = 0, texture = 2, drawable = 4},
glasses = {prop_id = 1, texture = 2, drawable = 4},
ears = {prop_id = 2, texture = 2, drawable = 4},
watches = {prop_id = 6, texture = 2, drawable = 4},
bracelets = {prop_id = 7, texture = 2, drawable = 4},
}
},
female = {
components = {
face = {component_id = 0, texture = 0, drawable = 2},
mask = {component_id = 1, texture = 0, drawable = 2},
hair = {component_id = 2, texture = 0, drawable = 2},
arms = {component_id = 3, texture = 0, drawable = 2},
pants = {component_id = 4, texture = 0, drawable = 22},
bag = {component_id = 5, texture = 1, drawable = 33},
shoes = {component_id = 6, texture = 1, drawable = 33},
accessory = {component_id = 7, texture = 1, drawable = 33},
shirt = {component_id = 8, texture = 1, drawable = 11},
bodyarmor = {component_id = 9, texture = 1, drawable = 33},
decals = {component_id = 10, texture = 1, drawable = 33},
jacket = {component_id = 11, texture = 2, drawable = 4},
},
props = {
hats = {prop_id = 0, texture = 2, drawable = 4},
glasses = {prop_id = 1, texture = 2, drawable = 4},
ears = {prop_id = 2, texture = 2, drawable = 4},
watches = {prop_id = 6, texture = 2, drawable = 4},
bracelets = {prop_id = 7, texture = 2, drawable = 4},
}
},
}
local function convertDataToFormat(characterData)
local gender = characterData.sex
local repackedClothingData = {
[gender] = {
components = {},
props = {}
}
}
local componentMap = {
tshirt_1 = 8, -- shirt
torso_1 = 11, -- jacket
decals_1 = 10, -- decals
arms = 3, -- arms
pants_1 = 4, -- pants
shoes_1 = 6, -- shoes
mask_1 = 1, -- mask
bproof_1 = 9, -- body armor
chain_1 = 7, -- accessory (could be a necklace)
bags_1 = 5, -- bag
}
for componentName, componentId in pairs(componentMap) do
if characterData[componentName] then
repackedClothingData[gender].components[componentName] = {
component_id = componentId,
texture = characterData[componentName.."_2"],
drawable = characterData[componentName.."_1"],
}
end
end
local propMap = {
{"helmet_1", 0}, -- helmet
{"glasses_1", 1}, -- glasses
{"ears_1", 2}, -- ears
{"watches_1", 6}, -- watches
{"bracelets_1", 7} -- bracelets
}
for _, prop in ipairs(propMap) do
local propName = prop[1]
local propId = prop[2]
if characterData[propName] then
repackedClothingData[gender].props[propName] = {
prop_id = propId,
texture = characterData[propName.."_2"],
drawable = characterData[propName.."_1"],
}
end
end
return repackedClothingData
end
Clothing.SetAppearance = function(clothingData)
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
clothingData = clothingData.male
clothingData.sex = 0
else
clothingData = clothingData.female
clothingData.sex = 1
end
local repackedClothingData = convertDataToFormat(clothingData)
StoredOldClothing = Clothing.GetAppearance
TriggerEvent('skinchanger:loadSkin', repackedClothingData)
return true
end
Clothing.GetAppearance = function()
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
StoredOldClothing = skin
end)
return true
end
Clothing.RestoreAppearance = function()
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
return true
end
Clothing.ReloadSkin = function()
local tableCheck = Table.TableContains(StoredOldClothing, "sex")
if not tableCheck then return Clothing.RestoreAppearance() end
return TriggerEvent('skinchanger:loadSkin', StoredOldClothing)
end
@@ -1,31 +0,0 @@
if GetResourceState('fivem-appearance') ~= 'started' then return end
Clothing = Clothing or {}
Clothing.SetAppearance = function(data)
local clothing = {}
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
clothing = data.male
else
clothing = data.female
end
ClothingBackup = exports['fivem-appearance']:getPedAppearance(cache.ped)
exports['fivem-appearance']:setPedAppearance(cache.ped, clothing)
return true
end
Clothing.GetAppearance = function()
return exports['fivem-appearance']:getPedAppearance(cache.ped)
end
Clothing.RestoreAppearance = function()
if not next(ClothingBackup) then
return false
end
exports['fivem-appearance']:setPedAppearance(cache.ped, ClothingBackup)
return true
end
Clothing.ReloadSkin = function()
TriggerEvent("fivem-appearance:client:reloadSkin", true)
return true
end
@@ -1,42 +0,0 @@
if GetResourceState('illenium-appearance') ~= 'started' then return end
Clothing = Clothing or {}
Clothing.SetAppearance = function(clothingData)
local clothing = {}
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
clothingData = clothingData.male
else
clothingData = clothingData.female
end
clothing.components = exports['illenium-appearance']:getPedComponents(cache.ped)
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
Prints.Debug(json.encode(clothingData, {indent = true}))
ClothingBackup = clothing
exports['illenium-appearance']:setPedComponents(cache.ped, clothingData.components)
exports['illenium-appearance']:setPedProp(cache.ped, clothingData.props)
return true
end
Clothing.GetAppearance = function()
local clothing = {}
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
clothing = clothing.male
else
clothing = clothing.female
end
clothing.components = exports['illenium-appearance']:getPedComponents(cache.ped)
clothing.props = exports['illenium-appearance']:getPedProps(cache.ped)
return clothing
end
Clothing.RestoreAppearance = function()
exports['illenium-appearance']:setPedComponents(cache.ped, ClothingBackup.components)
exports['illenium-appearance']:setPedProp(cache.ped, ClothingBackup.props)
return true
end
Clothing.ReloadSkin = function()
TriggerEvent("illenium-appearance:client:reloadSkin", true)
end
-75
View File
@@ -1,75 +0,0 @@
if GetResourceState('qb-clothing') ~= 'started' then return end
Clothing = Clothing or {}
Clothing.SetAppearance = function(data)
local clothingData = {}
local repackedTable = {}
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
clothingData = data.male
else
clothingData = data.female
end
ClothingBackup = Clothing.GetAppearance
local componentMap = {
[1] = 'mask',
[3] = 'arms',
[4] = 'pants',
[5] = 'bag',
[6] = 'shoes',
[7] = 'accessory',
[8] = 't-shirt',
[9] = 'vest',
[10] = 'decals',
[11] = 'torso2'
}
local propMap = {
[0] = 'hat',
[1] = 'glass',
[2] = 'ear',
[6] = 'watch',
[7] = 'bracelet'
}
local specialMap = {
eye_color_id = 'eye_color',
moles_id = 'moles',
ageing_id = 'ageing',
hair_id = 'hair',
face_id = 'face'
}
for _, v in pairs(clothingData) do
if componentMap[v.component_id] then
repackedTable[componentMap[v.component_id]] = {drawable = v.drawable, texture = v.texture}
elseif propMap[v.prop_id] then
repackedTable[propMap[v.prop_id]] = {drawable = v.drawable, texture = v.texture}
elseif specialMap[v.eye_color_id] then
repackedTable[specialMap[v.eye_color_id]] = {drawable = v.drawable, texture = v.texture}
elseif specialMap[v.moles_id] then
repackedTable[specialMap[v.moles_id]] = {drawable = v.drawable, texture = v.texture}
elseif specialMap[v.ageing_id] then
repackedTable[specialMap[v.ageing_id]] = {drawable = v.drawable, texture = v.texture}
elseif specialMap[v.hair_id] then
repackedTable[specialMap[v.hair_id]] = {drawable = v.drawable, texture = v.texture}
elseif specialMap[v.face_id] then
repackedTable[specialMap[v.face_id]] = {drawable = v.drawable, texture = v.texture}
end
end
TriggerEvent('qb-clothing:client:loadOutfit', repackedTable)
return true
end
Clothing.GetAppearance = function()
ClothingBackup = Utility.GetEntitySkinData(cache.ped)
return Utility.GetEntitySkinData(cache.ped)
end
Clothing.RestoreAppearance = function()
return Utility.SetEntitySkinData(cache.ped, ClothingBackup)
end
Clothing.ReloadSkin = function()
return exports['qb-clothing']:reloadSkin(GetEntityHealth(cache.ped))
end
-8
View File
@@ -1,8 +0,0 @@
if GetResourceState('qb-clothing') ~= 'started' then return end
RegisterNetEvent('qb-clothing:saveSkin', function(model, skin)
local src = source
if model and skin then
TriggerClientEvent('community_bridge:client:updateClothingBackup', src, skin)
end
end)
@@ -1,3 +1,6 @@
--[[This module is incomplete]]--
local promises = {} local promises = {}
local activeDialogue = nil local activeDialogue = nil
local pendingCameraDestroy = false local pendingCameraDestroy = false
@@ -0,0 +1,38 @@
if GetResourceState('lb-tablet') ~= 'started' then return end
Dispatch = Dispatch or {}
local function getPriorityLevel(priority)
if priority == 1 then
return 'low'
elseif priority == 2 then
return 'medium'
elseif priority == 3 then
return 'high'
else
return 'medium'
end
end
Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
local priority = getPriorityLevel(data.priority)
if type(data.jobs) == 'table' then
data.jobs = data.jobs[1]
end
if data.time and data.time > 1000 then
data.time = math.floor((data.time / 1000) + 0.5)
end
local alertData = {
priority = priority,
code = data.code or '10-80',
title = 'Dispatch Alert!',
description = data.message,
location = {
label = streetName,
coords = vec2(data.coords.x, data.coords.y)
},
time = data.time or 10000,
job = data.jobs,
}
TriggerServerEvent("community_bridge:server:dispatch:sendAlert", alertData)
end
@@ -0,0 +1,6 @@
if GetResourceState('lb-tablet') ~= 'started' then return end
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
exports["lb-tablet"]:AddDispatch(data) -- this has a return value but we dont really have a use for it atm.
end)
@@ -1,4 +1,5 @@
if GetResourceState('ps-dispatch') ~= 'started' then return end if GetResourceState('ps-dispatch') ~= 'started' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data) Dispatch.SendAlert = function(data)
@@ -1,2 +1,3 @@
if GetResourceState('ps-dispatch') ~= 'started' then return end if GetResourceState('ps-dispatch') ~= 'started' then return end
if GetResourceState('lb-tablet') == 'started' then return end
Dispatch = Dispatch or {} Dispatch = Dispatch or {}
@@ -0,0 +1,14 @@
if GetResourceState('redutzu-mdt') ~= 'started' then return end
Dispatch = Dispatch or {}
Dispatch.SendAlert = function(data)
local streetName, _ = Utility.GetStreetNameAtCoords(data.coords)
local alertData = {
code = data.code or '10-80',
message = data.message or "Dispatch Alert",
street = streetName,
time = data.time or 10000,
coords = data.coords,
}
TriggerServerEvent("community_bridge:server:dispatch:sendAlert", alertData)
end
@@ -0,0 +1,12 @@
if GetResourceState('redutzu-mdt') ~= 'started' then return end
Dispatch = Dispatch or {}
RegisterNetEvent("community_bridge:server:dispatch:sendAlert", function(data)
TriggerEvent('redutzu-mdt:server:addDispatchToMDT', {
code = data.code,
title = data.message,
street = data.street,
duration = data.time,
coords = data.coords
})
end)
-25
View File
@@ -47,29 +47,4 @@ function Language.Locale(str, ...)
return current return current
end end
if BridgeSharedConfig.DebugLevel == 2 then
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
-- whatever.Locales("some-index-in-language-.json-file")
-- Files must be stored in "locales" folder, within the resource.
-- Instead of using Require you can also import it via the manifest.
-- The Lang variable is available globally, which tells you what the server is using.
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("locale-unit-test"))
-- Example outside community bridge resource:
-- local Language = Require('modules/locales/shared.lua')
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("locale-unit-test"))
RegisterCommand("lang", function(source, args, raw)
print(Language.Locale("UNITTEST.UNITTEST.UNITTESTA"))
print(Language.Locale("UNITTEST.UNITTESTA", "Devil", "GERRRRRRR!"))
print( "Oh also this works", Language.Locale("place_object_scroll_down"))
end)
end
return Language return Language
@@ -1,14 +1,25 @@
if GetResourceState('Renewed-Banking') ~= 'started' then return end if GetResourceState('Renewed-Banking') ~= 'started' then return end
Managment = Managment or {} Managment = Managment or {}
---This will return a table with account details
---@param account string
---@return table
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['Renewed-Banking']:getAccountMoney(account) return exports['Renewed-Banking']:getAccountMoney(account)
end end
---This will add money to the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.AddAccountMoney = function(account, amount) Managment.AddAccountMoney = function(account, amount)
return exports['Renewed-Banking']:addAccountMoney(account, amount) return exports['Renewed-Banking']:addAccountMoney(account, amount)
end end
---This will remove money from the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.RemoveAccountMoney = function(account, amount) Managment.RemoveAccountMoney = function(account, amount)
return exports['Renewed-Banking']:removeAccountMoney(account, amount) return exports['Renewed-Banking']:removeAccountMoney(account, amount)
end end
+11
View File
@@ -1,14 +1,25 @@
if GetResourceState('okokBanking') ~= 'started' then return end if GetResourceState('okokBanking') ~= 'started' then return end
Managment = Managment or {} Managment = Managment or {}
---This will return a table with account details
---@param account string
---@return table
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['okokBanking']:GetAccount(account) return exports['okokBanking']:GetAccount(account)
end end
---This will add money to the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.AddAccountMoney = function(account, amount) Managment.AddAccountMoney = function(account, amount)
return exports['okokBanking']:AddMoney(account, amount) return exports['okokBanking']:AddMoney(account, amount)
end end
---This will remove money from the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.RemoveAccountMoney = function(account, amount) Managment.RemoveAccountMoney = function(account, amount)
return exports['okokBanking']:RemoveMoney(account, amount) return exports['okokBanking']:RemoveMoney(account, amount)
end end
+11
View File
@@ -1,14 +1,25 @@
if GetResourceState('qb-banking') ~= 'started' then return end if GetResourceState('qb-banking') ~= 'started' then return end
Managment = Managment or {} Managment = Managment or {}
---This will return a table with account details
---@param account string
---@return table
Managment.GetAccountMoney = function(account) Managment.GetAccountMoney = function(account)
return exports['qb-banking']:GetAccountBalance(account) return exports['qb-banking']:GetAccountBalance(account)
end end
---This will add money to the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.AddAccountMoney = function(account, amount) Managment.AddAccountMoney = function(account, amount)
return exports['qb-banking']:AddMoney(account, amount) return exports['qb-banking']:AddMoney(account, amount)
end end
---This will remove money from the specified account of the passed amount
---@param account string
---@param amount number
---@return boolean
Managment.RemoveAccountMoney = function(account, amount) Managment.RemoveAccountMoney = function(account, amount)
return exports['qb-banking']:RemoveMoney(account, amount) return exports['qb-banking']:RemoveMoney(account, amount)
end end
+4 -2
View File
@@ -2,7 +2,7 @@ Notify = Notify or {}
local notifyType = BridgeClientConfig.NotifySystem local notifyType = BridgeClientConfig.NotifySystem
local helptextType = BridgeClientConfig.ShowHelpText local helptextType = BridgeClientConfig.ShowHelpText
---comment ---This will send a notify message of the type and time passed
---@param message string ---@param message string
---@param _type string ---@param _type string
---@param time number ---@param time number
@@ -34,7 +34,7 @@ Notify.SendNotify = function(message, _type, time)
end end
end end
---comment ---This will show a help text message at the screen position passed
---@param message string ---@param message string
---@param _position string ---@param _position string
---@return nil ---@return nil
@@ -61,6 +61,8 @@ Notify.ShowHelpText = function(message, _position)
end end
end end
---This will hide the help text message on the screen
---@return nil
Notify.HideHelpText = function() Notify.HideHelpText = function()
if helptextType == 'ox' then if helptextType == 'ox' then
return exports.ox_lib:hideTextUI() return exports.ox_lib:hideTextUI()
+4 -2
View File
@@ -1,6 +1,6 @@
Notify = Notify or {} Notify = Notify or {}
---comment ---This will send a notification to the specified player of the passed message and type
---@param src number ---@param src number
---@param message string ---@param message string
---@param _type string ---@param _type string
@@ -9,7 +9,7 @@ Notify.SendNotify = function(src, message, _type, time)
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time) TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
end end
---comment ---This will show a help text message to the specified player at the screen position passed
---@param src number ---@param src number
---@param message string ---@param message string
---@param position string ---@param position string
@@ -17,6 +17,8 @@ Notify.ShowHelpText = function(src, message, position)
TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position) TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position)
end end
---This will hide the help text message on the screen for the specified player
---@param src number
Notify.HideHelpText = function(src) Notify.HideHelpText = function(src)
TriggerClientEvent('community_bridge:Client:HideHelpText', src) TriggerClientEvent('community_bridge:Client:HideHelpText', src)
end end
+11 -24
View File
@@ -7,30 +7,7 @@ RegisterNetEvent('community_bridge:openShop', function(_type, _title, shopData)
Shops.OpenShop(_title, shopData.inventory) Shops.OpenShop(_title, shopData.inventory)
end) end)
Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price) ---This is an internal event that is used to complete a transaction and offer cash/card pay
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) Shops.FinalizeCheckOut = function(shopName, item, itemLabel, price, amount)
if not shopName and not item and not itemLabel and not price then return end if not shopName and not item and not itemLabel and not price then return end
local mathStuff = tonumber(price) * tonumber(amount) 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) Menu.Open({ id = generatedID, title = locale("Shops.Input"), options = buildMenu }, false)
end 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) Shops.AmountSelect = function(shopName, item, itemLabel, price)
if not shopName and not item and not itemLabel and not price then return end if not shopName and not item and not itemLabel and not price then return end
local numberOptions = {} local numberOptions = {}
@@ -71,6 +53,11 @@ Shops.AmountSelect = function(shopName, item, itemLabel, price)
end end
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) Shops.OpenShop = function(title, shopData)
if not title and not shopData and not title then return print("No Title Passed") end if not title and not shopData and not title then return print("No Title Passed") end
local generatedID = Ids.CreateUniqueId() local generatedID = Ids.CreateUniqueId()
+19 -2
View File
@@ -2,20 +2,37 @@ Shops = Shops or {}
local registeredShops = {} local registeredShops = {}
---commentThis can open a shop for the client
---@param src number
---@param shopTitle string
---@return boolean
Shops.OpenShop = function(src, shopTitle) Shops.OpenShop = function(src, shopTitle)
if not shopTitle and not registeredShops[shopTitle] then return false end if not shopTitle and not registeredShops[shopTitle] then return false end
TriggerClientEvent('community_bridge:openShop', src, 'shop', shopTitle, registeredShops[shopTitle]) TriggerClientEvent('community_bridge:openShop', src, 'shop', shopTitle, registeredShops[shopTitle])
return true
end 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) 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 if registeredShops[shopTitle] then return true end
registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups} registeredShops[shopTitle] = {name = shopTitle, inventory = shopInventory, shopCoords = shopCoords, groups = shopGroups}
return true return true
end 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) 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 if not src and not shopName and not item and not amount and not paymentType then return end
local ilocale = Language.Locale local ilocale = Language.Locale
local shopData = registeredShops[shopName] local shopData = registeredShops[shopName]
+19
View File
@@ -0,0 +1,19 @@
-- if outside this resource, use local whatever = Require("modules/locales/shared.lua")
-- whatever.Locales("some-index-in-language-.json-file")
-- Files must be stored in "locales" folder, within the resource.
-- Instead of using Require you can also import it via the manifest.
-- The Lang variable is available globally, which tells you what the server is using.
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("locale-unit-test"))
-- Example outside community bridge resource:
-- local Language = Require('modules/locales/shared.lua')
-- print("Language: ", Lang)
-- print("Locale: ", Language.Locale("locale-unit-test"))
RegisterCommand("lang", function(source, args, raw)
print(Language.Locale("UNITTEST.UNITTEST.UNITTESTA"))
print(Language.Locale("UNITTEST.UNITTESTA", "Devil", "GERRRRRRR!"))
print( "Oh also this works", Language.Locale("place_object_scroll_down"))
end, false)