Skip to content

Commit 04e9040

Browse files
authored
Make playerblips visible only to other players (#642)
1 parent 65f7b72 commit 04e9040

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

[gameplay]/playerblips/server/main.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ function createPlayerBlip(player)
6666
blips[player]:setColor(r, g, b, blipAlpha)
6767
else
6868
blips[player] = Blip.createAttachedTo(player, 0, blipSize, r, g, b, blipAlpha, 0, blipRange)
69+
clearElementVisibleTo(blips[player])
70+
71+
for _, v in pairs(getElementsByType("player")) do
72+
if v ~= player then
73+
setElementVisibleTo(blips[player], v, true)
74+
end
75+
end
6976
end
7077
end
7178

@@ -92,6 +99,13 @@ function destroyPlayerBlip(player)
9299
colors[player] = nil
93100
end
94101

102+
addEventHandler("onPlayerJoin", root, function()
103+
for k, v in pairs(blips) do
104+
if k ~= source then
105+
setElementVisibleTo(v, source, true)
106+
end
107+
end
108+
end)
95109
addEventHandler("onPlayerQuit", root, function()
96110
destroyPlayerBlip(source)
97111
end)

0 commit comments

Comments
 (0)