Skip to content

SetPlayerInvisibleFor

Hides a player from one viewer, or shows them to one viewer while they are invisible to the rest.

One viewer’s own rule for the player, which wins over SetPlayerInvisible both ways: false lets this viewer see an invisible player (the other admins), true hides a visible player from this viewer alone, nil drops the rule. What a hidden player hides is the same as SetPlayerInvisible’s - body, gear, name plate, horse, voice, compass mark.

The rule is forgotten when the viewer leaves, and by a reload of the mode.

SetPlayerInvisibleFor(pid, viewer, invisible)
Parameter Type
pid number the player who is hidden or shown
viewer number the player whose screen the rule is for
invisible boolean|nil true hides pid from viewer, false shows them, nil follows SetPlayerInvisible again

boolean - false when either is not connected or both are the same player

-- the other team cannot see a scout; their own team can
local function hideScout(scout)
for _, other in ipairs(GetPlayers()) do
if other ~= scout then
SetPlayerInvisibleFor(scout, other, GetPlayerTeam(other) ~= GetPlayerTeam(scout))
end
end
end

SetPlayerInvisible · IsPlayerVisibleTo · the Players group of the index