ed
This commit is contained in:
parent
7533584a53
commit
c6be40ffbd
18 changed files with 1492 additions and 3 deletions
12
resources/[jobs]/[crime]/r_moneywash/utils/client.lua
Normal file
12
resources/[jobs]/[crime]/r_moneywash/utils/client.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Core = exports['r_bridge']:returnCoreObject()
|
||||
|
||||
local onPlayerLoaded = Core.Info.Framework == 'ESX' and 'esx:playerLoaded' or 'QBCore:Client:OnPlayerLoaded'
|
||||
RegisterNetEvent(onPlayerLoaded, function()
|
||||
TriggerEvent('r_moneywash:onConnect')
|
||||
end)
|
||||
|
||||
function _debug(...)
|
||||
if Cfg.Debug then
|
||||
print(...)
|
||||
end
|
||||
end
|
||||
63
resources/[jobs]/[crime]/r_moneywash/utils/server.lua
Normal file
63
resources/[jobs]/[crime]/r_moneywash/utils/server.lua
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
Core = exports['r_bridge']:returnCoreObject()
|
||||
|
||||
function SendWebhook(src, event, ...)
|
||||
if not Cfg.Webhook.Enabled then return end
|
||||
local name = '' if src > 0 then name = GetPlayerName(src) end
|
||||
local identifier = Core.Framework.GetPlayerIdentifier(src) or ''
|
||||
PerformHttpRequest(Cfg.Webhook.Url, function(err, text, headers)
|
||||
end, 'POST', json.encode({
|
||||
username = 'Resource Logs',
|
||||
avatar_url = 'https://i.ibb.co/z700S5H/square.png',
|
||||
embeds = {
|
||||
{
|
||||
color = 0x2C1B47,
|
||||
title = event,
|
||||
author = {
|
||||
name = GetCurrentResourceName(),
|
||||
icon_url = 'https://i.ibb.co/z700S5H/square.png',
|
||||
url = 'https://discord.gg/r-scripts'
|
||||
},
|
||||
thumbnail = {
|
||||
url = 'https://i.ibb.co/z700S5H/square.png'
|
||||
},
|
||||
fields = {
|
||||
{ name = _L('player_id'), value = src, inline = true },
|
||||
{ name = _L('username'), value = name, inline = true },
|
||||
{ name = _L('identifier'), value = identifier, inline = false },
|
||||
{ name = _L('description'), value = _L('description_text', name, ...), inline = false},
|
||||
},
|
||||
timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
|
||||
footer = {
|
||||
text = 'r_scripts',
|
||||
icon_url = 'https://i.ibb.co/z700S5H/square.png',
|
||||
},
|
||||
}
|
||||
}
|
||||
}), { ['Content-Type'] = 'application/json' })
|
||||
end
|
||||
|
||||
local function checkResourceVersion()
|
||||
if not Cfg.Server.VersionCheck then return end
|
||||
Core.VersionCheck(GetCurrentResourceName())
|
||||
SetTimeout(3600000, checkResourceVersion)
|
||||
end
|
||||
|
||||
function _debug(...)
|
||||
if Cfg.Debug then
|
||||
print(...)
|
||||
end
|
||||
end
|
||||
|
||||
AddEventHandler('onResourceStart', function(resourceName)
|
||||
if (GetCurrentResourceName() == resourceName) then
|
||||
print('------------------------------')
|
||||
print(_L('version', resourceName, GetResourceMetadata(resourceName, 'version', 0)))
|
||||
if GetResourceState('r_bridge') ~= 'started' then
|
||||
print('^1Bridge not detected, please ensure it is running.^0')
|
||||
else
|
||||
print('^2Bridge detected and loaded.^0')
|
||||
end
|
||||
print('------------------------------')
|
||||
checkResourceVersion()
|
||||
end
|
||||
end)
|
||||
19
resources/[jobs]/[crime]/r_moneywash/utils/shared.lua
Normal file
19
resources/[jobs]/[crime]/r_moneywash/utils/shared.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Language = Language or {}
|
||||
|
||||
---@param str string -- Name of the string to pull from the locale file
|
||||
function _L(str, ...)
|
||||
if str then
|
||||
local string = Language[Cfg.Server.Language][str]
|
||||
if string then
|
||||
return string.format(string, ...)
|
||||
else
|
||||
return "ERR_TRANSLATE_"..(str).."_404"
|
||||
end
|
||||
else
|
||||
return "ERR_TRANSLATE_404"
|
||||
end
|
||||
end
|
||||
|
||||
math.lerp = function(a, b, t)
|
||||
return a + (b - a) * t
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue