Entity extensions of the admin plugin: hiding an entity from chosen players by stopping its transmission to them, which the Vanish command is built on.

Summary

Methods

Stops or resumes networking this entity and all of its children to a player.
Stops or resumes networking this entity to every other player the condition does not exclude.

Methods

Entity:prevent_transmit(target, should_prevent)

server plugins/admin/plugin/lib/meta/sv_entity.lua:11

Stops or resumes networking this entity and all of its children to a player. Does nothing if the target is invalid.

Parameters

  • target Player the player to hide the entity from
  • should_prevent Boolean true to stop transmitting, false to resume

Entity:prevent_transmit_conditional(should_prevent, condition)

server plugins/admin/plugin/lib/meta/sv_entity.lua:36

Stops or resumes networking this entity to every other player the condition does not exclude. Also sets the entity's 'transmission_prevented' net var, sent only to itself.

-- Hide the player from everyone without the 'moderate' permission.
target:prevent_transmit_conditional(true, function(receiver)
  if receiver:can('moderate') then
    return false
  end
end)

Parameters

  • should_prevent Boolean true to stop transmitting, false to resume
  • condition Function optional, defaults to nil called as condition(receiver, entity, should_prevent); return false to leave that player unaffected

Defined in