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.
Syntax
Section titled “Syntax”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 |
Returns
Section titled “Returns”boolean - false when either is not connected or both are the same player
Example
Section titled “Example”-- the other team cannot see a scout; their own team canlocal function hideScout(scout) for _, other in ipairs(GetPlayers()) do if other ~= scout then SetPlayerInvisibleFor(scout, other, GetPlayerTeam(other) ~= GetPlayerTeam(scout)) end endendSee also
Section titled “See also”SetPlayerInvisible · IsPlayerVisibleTo · the Players group of the index
