Summary

Hooks

Returns whether a player may use a flashlight.
Called when a player switches their flashlight on or off; blocks turning it on without a flashlight.
Called at an interval while a player is connected; turns the flashlight off once the player no longer has one.

Hooks

PLUGIN:PlayerHasFlashlight(player)

server gamemodes/cwhl2rp/plugins/flashlight/plugin/sv_plugin.lua:15

Returns whether a player may use a flashlight.

Combine always may; other players need the cw_flashlight item, or must hold the flashlight weapon or a weapon whose item has hasFlashlight set.

Parameters

  • player Player The player to check

Returns

  • Boolean true when the player has a flashlight, otherwise nil

PLUGIN:PlayerSwitchFlashlight(player, on)

server gamemodes/cwhl2rp/plugins/flashlight/plugin/sv_hooks.lua:11

Called when a player switches their flashlight on or off; blocks turning it on without a flashlight.

Parameters

  • player Player The player toggling the flashlight
  • on Boolean Whether the flashlight is being turned on

Returns

  • Boolean false to block turning the flashlight on, otherwise nil

See also

PLUGIN:PlayerThink(player, curTime, infoTable)

server gamemodes/cwhl2rp/plugins/flashlight/plugin/sv_hooks.lua:21

Implements hook PlayerThink

Called at an interval while a player is connected; turns the flashlight off once the player no longer has one.

Parameters

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

Defined in