This plugin was originally part of the
Flare and Light Package. I have seperated the
Flare,
Flashlight and
Flare Gun into new plugins.
Thanks:- SilentBr - for the idea and request.
- Mr.RuyC - For recording videos and playing for hours and hours testing the plugin on his server.
- nakashimakun - Who came up with the plugin name. Also tested the plugin on his server.
- honorcode23, DJ_WEST, AtomicStryker, Boikinov, pimpinjuice and FoxMulder for source code (full credits inside the source).
- NanX, japan555, CeeJ, Farmer, SilentBr, sapphire989, Visual77, Mr. Man and everyone else who helped testing, it's been fun!
- disawar1 - Testing 2.0 and Russian translations.
- Januto - Spanish translations.
- Dont Fear The Reaper - German translations.
Details:- Attaches flashlights to survivors.
- Special Infected can now use. See the l4d_flashlight_users cvar.
- Spectators and dead players can have a personal flashlight only they can see.
- Saves clients flashlight color and on/off state.
- Flashlight colors can be locked so players cannot change. Put the cvar l4d_flashlight_lock to 1 and it will force the colors to what you specified in the config.
- Checks the command access overrides for "sm_light" as well as providing cvars to control access flags.
Player commands:
PHP Code:
sm_light // Toggle the attached flashlight. Usage: sm_light [R G B|off|random|red|green|blue|purple|cyan|orange|white|pink|lime|maroon|teal|yellow|grey]
sm_lightmenu // Opens the flashlight color menu.
// Examples:
sm_light 255 0 0 // Makes your flashlight red
sm_light purple // Makes your flashlight purple
Admin Commands: (requires "z" flag)
PHP Code:
sm_lightclient // Turn on/off the flashlight on specified player. Usage: sm_lightclient <#user id|name> [R G B|off|random|red|green|blue|purple|cyan|orange|white|pink|lime|maroon|teal|yellow|grey]
// Examples:
sm_lightclient Roch 0 0 255 // Makes Rochelle's light blue
sm_lightclient Nick green // Makes Nick's light green
sm_lightclient @survivors // Toggles the flashlights on all survivors.
CVars:
Saved to
l4d_flashlight.cfg in your servers
\cfg\sourcemod\ folder.
PHP Code:
// 0=Plugin off, 1=Plugin on.
l4d_flashlight_allow "1"
// Brightness of the light for Survivors <10-255> (changes Distance value)
// Minimum: "10.000000" Maximum: "255.000000"
l4d_flashlight_bright "255.0"
// Brightness of the light for Special Infected <10-255> (changes Distance value).
// Minimum: "10.000000" Maximum: "255.000000"
l4d_flashlight_brights "255.0"
// The default light color. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
l4d_flashlight_colour "200 20 15"
// Players with these flags may use the sm_light command. (Empty = all).
l4d_flashlight_flags ""
// 0=Off, 1=Show intro message to players entering spectator.
l4d_flashlight_hints "1"
// 0=Off, Show intro message in chat this many seconds after joining.
// Minimum: "0.000000" Maximum: "120.000000"
l4d_flashlight_intro "35.0"
// 0=Let players set their flashlight color, 1=Force to cvar specified.
l4d_flashlight_lock "0"
// Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
l4d_flashlight_modes ""
// Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
l4d_flashlight_modes_off ""
// Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
l4d_flashlight_modes_tog "0"
// Empty = Allow all. 0=Block on all maps. Prevent displaying the model on these maps, separate by commas (no spaces).
l4d_flashlight_precach "c1m3_mall"
// 0=Off, 1=Save client preferences for flashlight color and state.
l4d_flashlight_save "1"
// 0=Off, 1=Spectators, 2=Survivors, 4=Infected, 7=All. Give personal flashlights when dead which only they can see.
l4d_flashlight_spec "7"
// 1=Survivors, 2=Infected, 3=All. Allow these players when alive to use the flashlight.
l4d_flashlight_users "1"
// Flashlight plugin version.
l4d_flashlight_version
Changes:
Code:
2.28 (01-Oct-2023)
- Now sets the clients saved color if they spawned before client prefs were loaded. Thanks to "kochiurun119" for reporting.
2.27 (25-May-2023)
- Fixed the default light color not setting when new players join. Thanks to "iciaria" for reporting.
2.26 (22-Nov-2022)
- No longer shows the flashlight of the player you're spectating. Thanks to "yabi" for reporting.
2.25 (30-Sep-2022)
- Plugin now deletes the client cookie if they no longer have access to use the flashlight. Requested by "maclarens".
2.24 (19-Aug-2022)
- Added cvar "l4d_flashlight_brights" to control the brightness of lights for Special Infected. Requested by "A1ekin".
- Changed the light position on Special Infected and Spectators in an attempt to fix lighting the area. Thanks to "A1ekin" for reporting.
2.23 (01-May-2022)
- Added a 1 second delay before creating a light on spawn, to avoid the light flashing once. Thanks to "Ja-Forces" for reporting.
2.22 (15-Jan-2022)
- Fixed not saving light state across map changes. Thanks to "NoroHime" for reporting.
2.21 (01-Jan-2022)
- Fixed not setting the default color when "l4d_flashlight_default" is "1" and "l4d_flashlight_random" is "0". Thanks to "kalmas77" for reporting.
2.20 (25-Dec-2021)
- Fixed command "sm_light <color>" not changing the color. Thanks to "Shadowart" for reporting.
- Fixed cvar "l4d_flashlight_default" not restricting bots when set to "1". Thanks to "Shadowart" for reporting.
2.19 (09-Dec-2021)
- Changes to fix warnings when compiling on SourceMod 1.11.
- Changed command "sm_light" to accept "rand" or "random" as a parameter option to give a random light color. Requested by "NoroHime".
- Code change includes completely random color instead of specified from the list. Uncomment and delete other code if you want this instead.
2.18 (18-Sep-2021)
- Menu now returns to the page it was on before selecting an option. Requested by " Shadowart".
2.17 (04-Aug-2021)
- Changed the plugin to allow bots to use the color cvar when _default cvar is enabled _random cvar was disabled.
2.16 (31-Jul-2021)
- Added cvar "l4d_flashlight_default" to turn on the flashlight by default when spawning.
- Added cvar "l4d_flashlight_random" to give random colors when spawning.
2.15 (11-Jul-2021)
- Fixed the Special Infected light being visible to others. Thanks to "A1ekin" for reporting.
2.14 (11-Jul-2021)
- Added cvar "l4d_flashlight_users" to control if Survivors and Special Infected can use the plugins light.
- Fixed the Survivors spectator light attaching to their dead body and not themselves.
2.13 (01-Jul-2021)
- Added a warning message to suggest installing the "Attachments API" and "Use Priority Patch" plugins if missing.
2.12 (28-Apr-2021)
- Changed command "sm_light" to accept "off" param to turn off the light. Thanks to "Dragokas" for requesting.
2.11 (09-Oct-2020)
- Changed "OnClientPostAdminCheck" to "OnClientPutInServer" - to fix any issues if Steam service is down.
2.10 (18-Sep-2020)
- Added cookie preferences to save player flashlight color and state. Thanks to "GoGetSomeSleep" for requesting.
- Added cvar "l4d_flashlight_save" to control if the server can save and load client preferences.
2.9 (10-May-2020)
- Extra checks to prevent "IsAllowedGameMode" throwing errors.
- Increased "l4d_flashlight_precach" cvar length, max usable length 485 (due to game limitations).
- Various changes to tidy up code.
2.8 (01-Apr-2020)
- Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
- Removed "colors.inc" dependency.
- Updated these translation file encodings to UTF-8 (to display all characters correctly): Hungarian (hu).
2.7.1 (07-Jan-2020)
- Fixed "sm_light" not working with color names because 2 args were the wrong way round. Thanks to "K4d4br4" for reporting.
2.7 (19-Dec-2019)
- Added command "sm_lightmenu" to display a menu and select light color. No translations support.
- Added cvar "l4d_flashlight_precach" to prevent displaying the model on specific maps. Or "0" for all.
- Added to "sm_light" and "sm_lightclient" additional colors by name: "cyan" "pink" "lime" "maroon" "teal" "grey".
2.6.1 (21-Jul-2018)
- Added Hungarian translations - Thanks to KasperH.
- No other changes.
2.6.1 (18-Jun-2018)
- Fixed errors, thanks to "ReCreator" for reporting and testing.
2.6 (05-May-2018)
- Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
- Changed cvar "l4d_flashlight_modes_tog" now supports L4D1.
2.5.1 (19-Nov-2015)
- Fix to prevent garbage being passed into SetVariantString, as suggested by "KyleS".
2.5 (25-May-2012)
- Added more checks to events, preventing errors being logged.
2.4 (22-May-2012)
- Fixed cvar "l4d_flashlight_spec" enums mistake, thanks to "Dont Fear The Reaper".
- Fixed errors being logged on player spawn event when clients were not in game.
2.3 (22-May-2012)
- Changed cvar "l4d_flashlight_spec". The cvar is now a bit flag, add the numbers together.
- Fixed cvar "l4d_flashlight_spec" blocking alive survivors from using the flashlight.
2.2 (20-May-2012)
- Changed cvar "l4d_flashlight_spec". You can now specify which teams can use spectator lights.
- Added German translations - Thanks to "Dont Fear The Reaper".
2.1 (30-Mar-2012)
- Added Spanish translations - Thanks to "Januto".
- Added cvar "l4d_flashlight_modes_off" to control which game modes the plugin works in.
- Added cvar "l4d_flashlight_modes_tog" same as above, but only works for L4D2.
- Added cvar "l4d_flashlight_hints" which displays the "intro" message to spectators if spectator lights are enabled.
- Changed the way "l4d_flashlight_flags" validates clients by checking they have one of the flags specified.
- Fixed the "sm_lightclient" command not affecting all clients.
- Fixed the "sm_light" command not working for spectators.
- Fixed ghost players still having flashlights.
- Small changes and fixes.
2.0 (02-Dec-2011)
- Plugin separated and taken from the "Flare and Light Package" plugin.
- Added Russian translations - Thanks to "disawar1".
- Added personal flashlights for spectators and dead players. The light is invisible to everyone else.
- Added cvar "l4d_flashlight_spec" to control if spectators should have personal flashlights.
- Added the following triggers to specify colors with sm_light: red, green, blue, purple, orange, yellow, white.
- Saves players flashlight on/off state and colors on map change.
1.0 (29-Jan-2011)
- Initial release.
Compiling:- Put the plugins .sp file into your scripting folder and compile the plugin.
Installation:- Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.
- Install the Use Priority Patch plugin to prevent blocking +USE.
- Optional: Install the Attachment_API plugin to fix attachment positions breaking on model change.
Updating from 2.23 or older:- New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.
Current Translations: English (en), German (de), Hungarian (hu), Russian (ru), Spanish (es).