Garry's Mod Wiki

Revision Difference

Player:Flashlight#568052

<function name="Flashlight" parent="Player" type="classfunc"> <description>Enables/Disables the player's flashlight. <page>Player:CanUseFlashlight</page> must be true in order for the player's flashlight to be changed. <page>GM:PlayerSwitchFlashlight</page> can block this function. ⤶ <note>In thirdperson, the flashlight origin/angles will be set to the playermodel's or weapon worldmodel's `gmod_flashlight` attachment. If neither exist, the flashlight will instead follow the player's serverside <page text="EyePos">Entity:EyePos</page> and <page text="EyeAngles">Entity:EyeAngles</page>.⤶ ⤶ The flashlight renders a sprite along the projected texture angles. It will be parented to the playermodel's `r_hand` attachment if no `gmod_flashlight` attachment exists.⤶ ⤶ [Source](https://github.com/Facepunch/garrysmod-requests/issues/2898#issuecomment-3335037502)</note>⤶ </description> <realm>Server</realm> <args> <arg name="isOn" type="boolean">Turns the flashlight on/off</arg> </args> </function> <example> <description>Turns off and disables the player's flashlight</description> <code> Entity( 1 ):Flashlight( false ) Entity( 1 ):AllowFlashlight( false ) </code> </example>