This commit is contained in:
MrNewb committed 2025-08-12 21:32:20 -04:00
commit d6cb8ece6c
4 files changed
+78 -37

No files matched your search

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