more documentation

This commit is contained in:
MrNewb committed 2025-03-03 01:37:29 -05:00
1 parent 79ca0bc65a
commit ce1903b7d6
15 files changed
+140 -106

No files matched your search

+26
View File
@@ -8,10 +8,14 @@ Framework.GetFrameworkName = function()
return 'es_extended'
end
---comment
---@return table
Framework.GetPlayerData = function()
return ESX.PlayerData
end
---comment
---@return string
Framework.GetPlayerDob = function()
local playerData = ESX.GetPlayerData()
local dob = playerData.dateofbirth
@@ -22,35 +26,57 @@ Framework.GetPlayerMetaData = function(metadata)
return ESX.GetPlayerData().metadata[metadata]
end
---comment
---@param message string
---@param type string
---@param time number
---@return nil
Framework.Notify = function(message, type, time)
return ESX.ShowNotification(message, type, time)
end
---comment
---@return string
Framework.GetPlayerIdentifier = function()
local playerData = ESX.GetPlayerData()
return playerData.identifier
end
---comment
---@return string
---@return string
Framework.GetPlayerName = function()
local playerData = ESX.GetPlayerData()
return playerData.firstName, playerData.lastName
end
---comment
---@return string
---@return string
---@return string
---@return string
Framework.GetPlayerJob = function()
local playerData = ESX.GetPlayerData()
return playerData.job.name, playerData.job.label, playerData.job.grade_label, playerData.job.grade
end
---comment
---@param item string
---@return boolean
Framework.HasItem = function(item)
local hasItem = ESX.SearchInventory(item, true)
return hasItem > 0 and true or false
end
---comment
---@return table
Framework.GetPlayerInventory = function()
local playerData = ESX.GetPlayerData()
return playerData.inventory
end
---comment
---@return boolean
Framework.GetIsPlayerDead = function()
local playerData = ESX.GetPlayerData()
return playerData.dead
+9
View File
@@ -2,6 +2,11 @@ Notify = Notify or {}
local notifyType = BridgeClientConfig.NotifySystem
local helptextType = BridgeClientConfig.ShowHelpText
---comment
---@param message string
---@param _type string
---@param time number
---@return nil
Notify.SendNotify = function(message, _type, time)
time = time or 3000
if notifyType == 'qb' then
@@ -27,6 +32,10 @@ Notify.SendNotify = function(message, _type, time)
end
end
---comment
---@param message string
---@param _position string
---@return nil
Notify.ShowHelpText = function(message, _position)
if helptextType == 'ox' then
if _position == nil then _position = 'left-center' end
+9
View File
@@ -1,9 +1,18 @@
Notify = Notify or {}
---comment
---@param src number
---@param message string
---@param _type string
---@param time number
Notify.SendNotify = function(src, message, _type, time)
TriggerClientEvent('community_bridge:Client:Notify', src, message, _type, time)
end
---comment
---@param src number
---@param message string
---@param position string
Notify.ShowHelpText = function(src, message, position)
TriggerClientEvent('community_bridge:Client:ShowHelpText', src, message, position)
end
+5
View File
@@ -2,6 +2,11 @@ if GetResourceState('gksphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "gk
Phone = {}
---comment
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(email, title, message)
return exports["gksphone"]:SendNewMail({ sender = email, image = '/html/static/img/icons/mail.png', subject = title, message = message })
end
+9
View File
@@ -2,10 +2,19 @@ if GetResourceState('gksphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "gk
Phone = {}
---comment
---@param src number
---@return number||boolean
Phone.GetPlayerPhone = function(src)
return exports["gksphone"]:GetPhoneBySource(src) or false
end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message)
local data = {}
data.sender = email
+5
View File
@@ -2,6 +2,11 @@ if GetResourceState('lb-phone') ~= 'started' or (BridgeSharedConfig.Phone ~= "lb
Phone = {}
---comment
---@param email string
---@param title string
---@param message string
---@return nil
Phone.SendEmail = function(email, title, message)
TriggerServerEvent('community_bridge:Server:genericEmail', {email = email, title = title, message = message})
end
+6
View File
@@ -6,6 +6,12 @@ Phone.GetPlayerPhone = function(src)
return exports["lb-phone"]:GetEquippedPhoneNumber(src) or false
end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message)
local numberNumber = exports["lb-phone"]:GetEquippedPhoneNumber(src)
if not numberNumber then return false, Prints.Error("Could not Find Phone number") end
+5
View File
@@ -2,6 +2,11 @@ if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~
Phone = {}
---comment
---@param email string
---@param title string
---@param message string
---@return nil
Phone.SendEmail = function(email, title, message)
return TriggerServerEvent('qs-smartphone:server:sendNewMail', { sender = email, subject = title, message = message, button = {} })
end
+9
View File
@@ -1,10 +1,19 @@
if GetResourceState('qs-smartphone') ~= 'started' or (BridgeSharedConfig.Phone ~= "qs-smartphone" and BridgeSharedConfig.VehicleKey ~= "auto") then return end
Phone = {}
---comment
---@param src number
---@return number||boolean
Phone.GetPlayerPhone = function(src)
return exports['qs-base']:GetPlayerPhone(src) or false
end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
Phone.SendEmail = function(src, email, title, message)
TriggerClientEvent('community_bridge:Server:genericEmail', src, { sender = email, subject = title, message = message, button = {} })
return true
+9 -42
View File
@@ -1,43 +1,3 @@
-- if BridgeClientConfig.ProgressBar ~= "ox" then return end
-- Progressbar = {}
-- local _progBarType = BridgeClientConfig.ProgressBarStyle or "bar"
-- Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
-- local runTime = time or 10000
-- local textLabel = label or "Doing something"
-- local deadBool = whiledead or false
-- local cancelBool = cancancel or false
-- local disableKeys = disable or { move = true, sprint = true, car = true, combat = true, }
-- local anim = animTable or nil
-- local success = successAction or function() Prints.Debug("Success") end
-- local canceled = canceledAction or function() Prints.Debug("Cancelled") end
-- if _progBarType == "bar" then
-- if exports.ox_lib:progressBar({
-- duration = runTime,
-- label = textLabel,
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- disable = disableKeys,
-- anim = anim,
-- }) then success() else canceled() end
-- elseif _progBarType == "circle" then
-- if exports.ox_lib:progressCircle({
-- duration = runTime,
-- label = textLabel,
-- position = 'bottom',
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- disable = disableKeys,
-- anim = anim,
-- }) then success() else canceled() end
-- end
-- end
-- Progressbar.IsProgressBarActive = function()
-- return exports.ox_lib:progressActive()
-- end
if GetResourceState('ox_lib') ~= 'started' or (BridgeClientConfig.ProgressBarSystem ~= "ox" and BridgeClientConfig.InputSystem ~= "auto") then return end
ProgressBar = ProgressBar or {}
@@ -81,18 +41,24 @@ local function convertFromQB(options)
}
end
---comment
---@param options table
---@param cb any
---@param isQBInput boolean
---@return nil
function ProgressBar.Open(options, cb, isQBInput)
if isQBInput then
options = convertFromQB(options)
end
local style = options.style or 'bar'
local success = style == 'circle' and exports.ox_lib:progressCircle(options) or exports.ox_lib:progressBar(options)
if cb then cb(not success) end
return success
end
--[[
RegisterCommand("progressbar", function()
ProgressBar.Open({
duration = 5000,
@@ -109,3 +75,4 @@ RegisterCommand("progressbar", function()
print(cancelled and "Cancelled" or "Complete")
end)
end)
--]]
+9 -64
View File
@@ -1,65 +1,3 @@
-- if BridgeClientConfig.ProgressBar ~= "qb" then return end
-- Progressbar = {}
-- local function convertOxToQB(disabledTable, animTable)
-- local repackedTable = { disabled = {}, animations = {}}
-- for _, v in pairs(disabledTable) do
-- if v.move then
-- repackedTable.disabled.disableMovement = v.move
-- end
-- if v.car then
-- repackedTable.disabled.disableCarMovement = v.car
-- end
-- if v.combat then
-- repackedTable.disabled.disableCombat = v.combat
-- end
-- if v.mouse then
-- repackedTable.disabled.disableMouse = v.mouse
-- end
-- end
-- for _, v in pairs(animTable) do
-- if v.dict then
-- repackedTable.animations.animDict = v.animDict
-- end
-- if v.clip then
-- repackedTable.animations.anim = v.anim
-- end
-- end
-- return repackedTable
-- end
-- Progressbar.StartProgressBar = function(time, label, whiledead, cancancel, disable, animTable, successAction, canceledAction)
-- local runTime = time or 10000
-- local textLabel = label or "Doing something"
-- local deadBool = whiledead or false
-- local cancelBool = cancancel or false
-- local success = successAction or function() Prints.Debug("Success") end
-- local canceled = canceledAction or function() Prints.Debug("Cancelled") end
-- local repackedTable = convertOxToQB(disable, animTable)
-- exports['progressbar']:Progress({
-- name = textLabel,
-- duration = runTime,
-- label = textLabel,
-- useWhileDead = deadBool,
-- canCancel = cancelBool,
-- controlDisables = repackedTable.disabled,
-- animation = repackedTable.animations,
-- prop = {},
-- propTwo = {}
-- }, function(cancelled)
-- if not cancelled then
-- success()
-- else
-- canceled()
-- end
-- end)
-- end
-- Progressbar.IsProgressBarActive = function()
-- return exports["progressbar"]:isDoingSomething()
-- end
if GetResourceState('progressbar') ~= 'started' or (BridgeClientConfig.ProgressBarSystem ~= "qb" and BridgeClientConfig.ProgressBarSystem ~= "auto") then return end
ProgressBar = ProgressBar or {}
@@ -98,18 +36,24 @@ local function convertFromOx(options)
}
end
---comment
---@param options table
---@param cb any
---@param qbFormat boolean
---@return nil
function ProgressBar.Open(options, cb, qbFormat)
if not exports['progressbar'] then return false end
if not qbFormat then
options = convertFromOx(options)
end
exports['progressbar']:Progress(options, cb)
end
-- Example usage:
--[[
RegisterCommand("progressbar", function()
ProgressBar.Open({
duration = 5000,
@@ -131,3 +75,4 @@ RegisterCommand("progressbar", function()
print(cancelled and "Cancelled" or "Complete")
end)
end)
--]]
+33
View File
@@ -28,16 +28,25 @@ Target.FixOptions = function(options)
return options
end
---comment
---@param options table
---@return nil
Target.AddGlobalPlayer = function(options)
options = Target.FixOptions(options)
ox_target:addGlobalPlayer(options)
end
---comment
---@param options table
---@return nil
Target.AddGlobalVehicle = function(options)
options = Target.FixOptions(options)
ox_target:addGlobalVehicle(options)
end
---comment
---@param options table
---@return nil
Target.RemoveGlobalVehicle = function(options)
local assembledLables = {}
for k, v in pairs(options) do
@@ -46,16 +55,31 @@ Target.RemoveGlobalVehicle = function(options)
ox_target:removeGlobalVehicle(assembledLables)
end
---comment
---@param entities table
---@param options table
---@return nil
Target.AddLocalEntity = function(entities, options)
options = Target.FixOptions(options)
ox_target:addLocalEntity(entities, options)
end
---comment
---@param models table
---@param options table
---@return nil
Target.AddModel = function(models, options)
options = Target.FixOptions(options)
ox_target:addModel(models, options)
end
---comment
---@param name string
---@param coords table
---@param size table
---@param heading number
---@param options table
---@return number
Target.AddBoxZone = function(name, coords, size, heading, options)
options = Target.FixOptions(options)
local target = ox_target:addBoxZone({
@@ -73,14 +97,23 @@ Target.RemoveGlobalPlayer = function()
ox_target:removeGlobalPlayer()
end
---comment
---@param entity number
---@return nil
Target.RemoveLocalEntity = function(entity)
ox_target:removeLocalEntity(entity)
end
---comment
---@param model string
---@return nil
Target.RemoveModel = function(model)
ox_target:removeModel(model)
end
---comment
---@param name string
---@return nil
Target.RemoveZone = function(name)
for _, data in pairs(targetZones) do
if data.name == name then
@@ -1,6 +1,8 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle)
if toggle then
TriggerEvent("qb-weathersync:client:EnableSync")
@@ -1,6 +1,8 @@
if GetResourceState('Renewed-Weathersync') ~= 'started' then return end
Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle)
LocalPlayer.state.syncWeather = toggle
end
+2
View File
@@ -1,6 +1,8 @@
if GetResourceState('qb-weathersync') ~= 'started' then return end
Weather = {}
---comment
---@param toggle boolean
Weather.ToggleSync = function(toggle)
if toggle then
TriggerEvent("qb-weathersync:client:EnableSync")