mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 16:23:22 +00:00
ADD - implement CrewLink location groups
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
local overhead_members = {}
|
||||
|
||||
local function draw_overhead_label(coords, username, role)
|
||||
SetDrawOrigin(coords.x, coords.y, coords.z + 1.05, 0)
|
||||
SetTextScale(0.0, 0.29)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(true)
|
||||
SetTextColour(235, 245, 255, 235)
|
||||
SetTextCentre(true)
|
||||
SetTextOutline()
|
||||
BeginTextCommandDisplayText("STRING")
|
||||
AddTextComponentSubstringPlayerName(("~b~%s~s~ %s"):format(username, role))
|
||||
EndTextCommandDisplayText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local result = Bridge.Callbacks.Trigger("sky_phone:crewlink:overhead", {})
|
||||
overhead_members = result and result.success and result.data and result.data.members or {}
|
||||
Wait(Config.CrewLink.OverheadRefreshMilliseconds)
|
||||
end
|
||||
end)
|
||||
|
||||
CreateThread(function()
|
||||
while true do
|
||||
local sleep = 1000
|
||||
if #overhead_members > 0 then
|
||||
sleep = 0
|
||||
local player_coords = GetEntityCoords(PlayerPedId())
|
||||
for _, member in ipairs(overhead_members) do
|
||||
local player = GetPlayerFromServerId(member.source)
|
||||
if player ~= -1 then
|
||||
local ped = GetPlayerPed(player)
|
||||
local coords = GetEntityCoords(ped)
|
||||
if #(player_coords - coords) <= Config.CrewLink.OverheadDistance then
|
||||
draw_overhead_label(coords, member.username, member.roleLabel)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Wait(sleep)
|
||||
end
|
||||
end)
|
||||
@@ -147,6 +147,25 @@ local server_callbacks = {
|
||||
"map:markers",
|
||||
"map:create-marker",
|
||||
"map:delete-marker",
|
||||
"crewlink:bootstrap",
|
||||
"crewlink:create-profile",
|
||||
"crewlink:update-profile",
|
||||
"crewlink:create-group",
|
||||
"crewlink:update-group",
|
||||
"crewlink:delete-group",
|
||||
"crewlink:set-active",
|
||||
"crewlink:join-code",
|
||||
"crewlink:rotate-code",
|
||||
"crewlink:nearby",
|
||||
"crewlink:invite-nearby",
|
||||
"crewlink:respond-invite",
|
||||
"crewlink:update-member",
|
||||
"crewlink:transfer-owner",
|
||||
"crewlink:remove-member",
|
||||
"crewlink:leave",
|
||||
"crewlink:create-ping",
|
||||
"crewlink:remove-ping",
|
||||
"crewlink:live",
|
||||
"sim:insert",
|
||||
"sim:eject",
|
||||
"contacts:list",
|
||||
@@ -617,6 +636,22 @@ RegisterNetEvent("sky_phone:billing:new", function(data)
|
||||
SendNUIMessage({ type = "billing:new", data = data })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("sky_phone:crewlink:changed", function(data)
|
||||
SendNUIMessage({ type = "crewlink:changed", data = data })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("sky_phone:crewlink:notification", function(data)
|
||||
local crewlink_locale = get_locale().Nui.Apps.crewlink
|
||||
local notification_text = crewlink_locale.notifications[data.kind]
|
||||
or crewlink_locale.notifications.default
|
||||
data.title = crewlink_locale.name
|
||||
data.text = notification_text
|
||||
:gsub("{actor}", tostring(data.actor or ""))
|
||||
:gsub("{group}", tostring(data.groupName or ""))
|
||||
:gsub("{ping}", tostring(data.pingLabel or ""))
|
||||
SendNUIMessage({ type = "crewlink:notification", data = data })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("sky_phone:messages:changed", function(data)
|
||||
SendNUIMessage({ type = "messages:changed", data = data })
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user