This commit is contained in:
Mr.Crowley committed 2025-08-12 19:23:15 -05:00
1 parent 29c19f3cb4
commit e11ef1242d
4 files changed
+80 -39

No files matched your search

+31
View File
@@ -183,6 +183,37 @@ function ClientEntity.OnCreate(_type, func)
table.insert(ClientEntity.OnCreates[_type], func)
end
function ClientEntity.SetOnSpawn(id, func)
local entityData = Entities[id]
if not entityData then
print(string.format("[ClientEntity] SetOnSpawn: Entity %s does not exist", id))
return
end
entityData.OnSpawn = func
end
function ClientEntity.SetOnRemove(id, func)
local entityData = Entities[id]
if not entityData then
print(string.format("[ClientEntity] SetOnRemove: Entity %s does not exist", id))
return
end
entityData.OnRemove = func
end
function ClientEntity.UpdateCoords(id, coords)
local entityData = Entities[id]
if not entityData then
print(string.format("[ClientEntity] UpdateCoords: Entity %s does not exist", id))
return
end
entityData.coords = coords
Point.UpdateCoords(id, coords)
if entityData.spawned and DoesEntityExist(entityData.spawned) then
SetEntityCoords(entityData.spawned, coords.x, coords.y, coords.z, false, false, false, true)
end
end
-- Network Event Handlers
RegisterNetEvent("community_bridge:client:CreateEntity", function(entityData)
ClientEntity.Create(entityData)
+42 -34
View File
@@ -55,46 +55,54 @@ Logs.Send = function(src, message)
end
end
local embeds = {}
Logs.Notify = function(src, url, image, message)
if not src or not message then return end
local logType = LogSystem or "built-in"
if logType == "built-in" then
embeds[url] = embeds[url] or {}
local embed = embeds[url].embed or {}
local firstName, lastName = Framework.GetPlayerName(src)
PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode(
{
username = string.format("%s %s", firstName, lastName),
avatar_url = image or 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4',
embeds = {
table.insert(embed, {
color = "15769093",
title = GetInvokingResource(),
-- url = 'https://discord.gg/Gm6rYEXUsn',
thumbnail = { url = LogoForEmbed },
fields = {
{
color = "15769093",
title = GetInvokingResource(),
-- url = 'https://discord.gg/Gm6rYEXUsn',
thumbnail = { url = LogoForEmbed },
fields = {
{
name = '**Player ID**',
value = src,
inline = true,
},
{
name = '**Player Identifier**',
value = Framework.GetPlayerIdentifier(src),
inline = true,
},
{
name = 'Log Message',
value = "```"..message.."```",
inline = false,
},
},
timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {
text = "Community_Bridge | ",
icon_url = 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4',
},
}
}
}), { ['Content-Type']= 'application/json' })
name = '**Player ID**',
value = src,
inline = true,
},
{
name = '**Player Identifier**',
value = Framework.GetPlayerIdentifier(src),
inline = true,
},
{
name = 'Log Message',
value = "```"..message.."```",
inline = false,
},
},
timestamp = os.date('!%Y-%m-%dT%H:%M:%S'),
footer = {
text = "Community_Bridge | ",
icon_url = 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4',
},
})
embeds[url].embed = embed
if embeds[url].inProgress then return end
embeds[url].inProgress = true
SetTimeout(5000, function()
PerformHttpRequest(url, function(err, text, headers) end, 'POST', json.encode({
username = string.format("%s %s", firstName, lastName),
avatar_url = image or 'https://avatars.githubusercontent.com/u/192999457?s=400&u=da632e8f64c85def390cfd1a73c3b664d6882b38&v=4',
embeds = embeds[url].embed
}), { ['Content-Type']= 'application/json' })
embeds[url].inProgress = false
end)
elseif logType == "qb" then
return TriggerEvent('qb-log:server:CreateLog', GetCurrentResourceName(), GetCurrentResourceName(), 'green', message)
elseif logType == "ox_lib" then
+1 -1
View File
@@ -8,7 +8,7 @@ function Particle.New(data)
assert(data.dict, "Invalid particle data. Must contain string dict.")
assert(data.ptfx, "Invalid particle data. Must contain string ptfx.")
local _id = data.id or id.CreateUniqueId(Particles)
local _id = data.id or Bridge.Ids.CreateUniqueId(Particles)
data = {
id = _id,
dict = data.dict,
+6 -4
View File
@@ -270,16 +270,18 @@ function Utility.HelpText(text, duration)
EndTextCommandDisplayHelp(0, false, true, duration or 5000)
end
local doingstuff = false
---Show a floating help text in the world
---@param text string The text to show
---@param coords table The coords to show the message at
---@return nil
function Utility.FloatingHelpText(text, coords)
AddTextEntry("community_bridge_"..text, "community_bridge_"..text)
SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z)
function Utility.FloatingHelpText(text, coords)
AddTextEntry("community_bridge_"..text, text)
SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z)
SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0)
BeginTextCommandDisplayHelp("community_bridge_"..text)
EndTextCommandDisplayHelp(2, false, false, -1)
EndTextCommandDisplayHelp(2, false, false, 100)
end
---Draw 3D help text in the world