This commit is contained in:
gononono64 committed 2025-05-05 13:57:09 -05:00
commit 93ebca8762
12 files changed
+504 -198

No files matched your search

+4 -3
View File
@@ -243,6 +243,7 @@ end
Framework.AddAccountBalance = function(src, _type, amount)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
if _type == 'cash' then _type = 'money' end
return xPlayer.addAccountMoney(_type, amount)
end
@@ -251,6 +252,7 @@ end
Framework.RemoveAccountBalance = function(src, _type, amount)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
if _type == 'cash' then _type = 'money' end
xPlayer.removeAccountMoney(_type, amount)
return true
end
@@ -260,6 +262,7 @@ end
Framework.GetAccountBalance = function(src, _type)
local xPlayer = ESX.GetPlayerFromId(src)
if not xPlayer then return end
if _type == 'cash' then _type = 'money' end
return xPlayer.getAccount(_type).money
end
@@ -330,6 +333,4 @@ Framework.Commands.Add = function(name, help, arguments, argsrequired, callback,
help = help,
arguments = arguments
})
end
-- test
end
+16
View File
@@ -0,0 +1,16 @@
local resourceName = "okokPhone"
local configValue = BridgeSharedConfig.Phone
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param email string
---@param title string
---@param message string
---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(email, title, message)
local success = lib.callback.await('community_bridge:Callback:okokPhone:sendEmail', false, email, title, message) --[[ @as boolean ]]
return success
end
+55
View File
@@ -0,0 +1,55 @@
---@class NewEmail
---@field sender string
---@field recipients string[]
---@field subject string
---@field actions? EmailAction[]
---@field body string
---@class EmailAction
---@field id string
---@field label string
---@field event string?
---@field exports string?
---@field server boolean
---@field data any
local resourceName = "okokPhone"
local configValue = BridgeSharedConfig.Phone
if (configValue == "auto" and GetResourceState(resourceName) ~= "started") or (configValue ~= "auto" and configValue ~= resourceName) then return end
Phone = Phone or {}
---comment
---@param src number
---@return number| boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.GetPlayerPhone = function(src)
return exports.okokPhone:getPhoneNumberFromSource(src) or false
end
---comment
---@param src number
---@param email string
---@param title string
---@param message string
---@return boolean
---@diagnostic disable-next-line: duplicate-set-field
Phone.SendEmail = function(src, email, title, message)
local senderAddress = exports.okokPhone:getEmailAddressFromSource(src) --[[ @as string? ]]
if not senderAddress then return false end
---@type NewEmail
local data = {
sender = senderAddress,
recipients = { email },
subject = title,
body = message,
}
local success = exports.okokPhone:sendEmail(data) --[[ @as boolean ]]
return success
end
lib.callback.registry('community_bridge:Callback:okokPhone:sendEmail', function(src, email, title, message)
return Phone.SendEmail(src, email, title, message)
end)