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:15Returns 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
truewhen the player has a flashlight, otherwisenil
PLUGIN:PlayerSwitchFlashlight(player, on)
server gamemodes/cwhl2rp/plugins/flashlight/plugin/sv_hooks.lua:11Called 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
falseto block turning the flashlight on, otherwisenil
See also
PLUGIN:PlayerThink(player, curTime, infoTable)
server gamemodes/cwhl2rp/plugins/flashlight/plugin/sv_hooks.lua:21Implements 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