View Single Post
Author Message
Mitchell
~lick~
Join Date: Mar 2010
Old 09-28-2013 , 17:38   [CS:GO] Flashlight (1.3.62)
Reply With Quote #1

CS:GO Flashlight.
Description:
Since valve technically removed it for some stupid command to look at your gun skin, server owners can put this on their server to replace that command with a flashlight.

Commands:
sm_flashlight: (bind t sm_flashlight) this is a secondary command for player to bind.

Convars:
A config is made also in cfg/sourcemod/ folder.
sm_flashlight_lookatweapon: (def 1) disables the hook of +lookatweapon.
sm_flashlight_return: (def 0) determines whether to ignore the command completely or to continue the command.
sm_flashlight_sound: (def "items/flashlight1.wav") The sound the flashlight makes when toggled (default included)
sm_flashlight_sound_all: (def 1) Will the sound be played to all players?

Convar: (cont)
1. If you want to have the +lookatweapon to still work and not turn on flashlight, and just have the command: sm_flashlight, set the following cvars to these values: (no need to set return to anything cause the cvar is skipped due to the fact lookatweapon cvar is checked first in the hook.
Code:
sm_flashlight_lookatweapon 0
2. If you want to have +lookatweapon still look at the weapon and turn on the flashlight use this config:
Code:
sm_flashlight_lookatweapon 1
sm_flashlight_return 1
3. The third option is my favorite cause it replaces a command i never use (+lookatweapon) which is the default variables. Uses this config.
Code:
sm_flashlight_lookatweapon 1
sm_flashlight_return 0
Version Notes:
1.3.63: Fixed the convar hook of Sound All.
1.3.62: Custom sounds are now fixed and downloaded correctly. (479 downloads)
1.3.6: Sounds are now fixed and properly precached and played. Also added the sm_flashlight_sound_all ConVar. (2.7k Downloads)
1.3.5: Custom flashlight sounds are now automatically added to download table (2.2k Downloads since 2013, Wow!)
1.3.4: Removed the required emitany include.
1.3.3: Added Sound
1.3.2: Added Enabled Cvar (958 downloads from last update)
1.3.1: Added to check if the player is in the current gaming session to avoid errors.
1.3.0: Adjusted code to be more clean, and added comments.
1.2.0: Added a cvar to enable the return, also a cvar to disable the +lookatweapon hook. and the cvar sm_flashlight
1.1.0: Bacardi gave me some bit examples which i consider in this update, and replaced the check with just IsPlayerAlive().
1.0.0: initial release.
Attached Files
File Type: sp Get Plugin or Get Source (CsGoFlashlight.sp - 9536 views - 3.9 KB)

Last edited by Mitchell; 05-27-2016 at 11:33. Reason: Updated to 1.3.62
Mitchell is offline