Summary

Hooks

Called to collect a player's status text; adds the observer label to noclipping players.
Puts a player into observer mode.
Takes a player out of observer mode.
Called to check whether the local player can see the admin ESP; only allows it while noclipping.
Called when a player tries to noclip; runs the Observer command for them instead.
Called periodically for every player; keeps observers invisible and takes others out of observer mode.

Hooks

cwObserverMode:GetStatusInfo(player, text)

client gamemodes/catwork/plugins/observermode/plugin/cl_hooks.lua:17

Implements hook GetStatusInfo

Called to collect a player's status text; adds the observer label to noclipping players.

Parameters

  • player Player The player whose status is shown
  • text List<String> Status lines to add to

cwObserverMode:MakePlayerEnterObserverMode(player)

server gamemodes/catwork/plugins/observermode/plugin/sv_plugin.lua:60

Puts a player into observer mode.

Stores the player's move type, position, eye angles and color so they can be restored later, then enables noclip and makes NPCs ignore them. Hiding the player is done in the PlayerThink hook.

Parameters

  • player Player The player entering observer mode

See also

cwObserverMode:MakePlayerExitObserverMode(player)

server gamemodes/catwork/plugins/observermode/plugin/sv_plugin.lua:17

Takes a player out of observer mode.

Makes the player visible and solid again and restores their move type at once. Half a frame later it restores their color, and their position and eye angles from before entering when the observer_reset config is on, then clears the observer state.

Parameters

  • player Player The player leaving observer mode

See also

cwObserverMode:PlayerCanSeeAdminESP()

client gamemodes/catwork/plugins/observermode/plugin/cl_hooks.lua:7

Implements hook PlayerCanSeeAdminESP

Called to check whether the local player can see the admin ESP; only allows it while noclipping.

Returns

  • Boolean False when the player is not noclipping, otherwise nil

cwObserverMode:PlayerNoClip(player)

shared gamemodes/catwork/plugins/observermode/plugin/sv_hooks.lua:11

On the server

Called when a player tries to noclip; runs the Observer command for them instead.

Parameters

  • player Player The player trying to noclip

Returns

  • Boolean Always false, so the engine noclip never happens

On the client

Called when the local player tries to noclip; blocks the client-side prediction of it.

Parameters

  • player Player The player trying to noclip

Returns

  • Boolean Always false

Defined in

cwObserverMode:PlayerThink(player, curTime, infoTable)

server gamemodes/catwork/plugins/observermode/plugin/sv_hooks.lua:25

Implements hook PlayerThink

Called periodically for every player; keeps observers invisible and takes others out of observer mode.

A noclipping player who is alive, not in a vehicle, not ragdolled and not held is hidden and made non-solid. Players who are still flagged as observers but no longer qualify are taken out with cwObserverMode:MakePlayerExitObserverMode.

Parameters

  • player Player The player being updated
  • curTime Number The current time
  • infoTable Map The player's info table for this think

Defined in