View Single Post
Author Message
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-01-2012 , 16:08   [L4D2] Flare Gun (2.16) [05-Sep-2023]
Reply With Quote #1


  • Converts the Grenade Launcher into 1 of 8 types and provides a menu to select the type. Projectiles can ignite infected/players/explosives.
  • 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 a video of the first version and playing for hours and hours testing the plugin on his server.
  • nakashimakun - Who came up with the plugin name and the clientprefs code for !flaregun. Also testing the plugin on their server.
  • honorcode23, DJ_WEST, AtomicStryker, Boikinov, pimpinjuice and FoxMulder for source code (full credits inside the source).
  • Downtown1, ProdigySim and psychonic - For "[EXTENSION] Left 4 Downtown 2" gamedata to stumble players.
  • januto - Lots of testing on their server, Spanish translations and the idea for the Sensor type.
  • [Resistance] Yoshi - Lots of help testing and ideas about balancing.
  • Lux and Timocop for removing gamedata dependency.
  • disawar1 - For Russian translations.
  • januto - For Spanish translations.
  • Dont Fear The Reaper - For German translations.
  • HarryPotter - For Simplified Chinese and Traditional Chinese translations.
  • NanX, japan555, CeeJ, Farmer, SilentBr, sapphire989, Visual77, Mr. Man, disawar1, alexip121093, xioSlayer and everyone else who helped testing, it's been fun!


Types:

Stock (grenade launcher):
Default explosion with no effects. The speed and gravity is affected by this plugins cvar.

Flare (stock explosion):
As above but with Flare and Light effects.

Sticky Flare (no explosion):
Flare projectile which sticks to world surfaces and illuminates the area.

Bounce (ignites, no explosion):
Projectile which bounces and sets explosives/infected/special infected/survivors on fire.

Jump Launcher:
Flare projectiles which stick to world surfaces. Players who jump over their own projectiles and shove (right click) will be teleported away. Players are limited to 3 shots which multiply the force.

Remote (right click):
The Remote bomb sticks to world surfaces and explodes when the owner shoves (right clicks).

Sensor Bomb:
These proximity bombs stick to world surfaces and explode when common or special infected walk near.

Timed Bomb:
Flare projectiles stick to world surfaces and explode after time set by l4d2_flare_gun_time_timed.


Details:
  • The !flaregun command displays a menu to select the Grenade Launcher type. Admins with these flags l4d2_flare_gun_menu_admin have access to all types.
  • Non-admins can be limited to which types are allowed by setting the cvar: l4d2_flare_gun_types.
  • The menu can be displayed when players first pickup the Grenade Launcher, set by l4d2_flare_gun_auto_menu.
  • Total shot projectiles are limited to 16 for admins. Total projectiles limited by l4d2_flare_gun_max_total. Non-admins are limited by l4d2_flare_gun_max.
  • When the maximum cvar is reached, projectiles which are shot will be deleted and the Grenade Launcher reloaded.
  • The plugin also checks the command access overrides for 'sm_flaregun' to allow/disallow the menu to players.
  • The projectile speed and gravity can be changed. Negative gravity values will make the projectile fly up and negative speed values will make the projectile fly in the opposite direction from where it was shot.
  • Damage from the Jump, Remote, Sensor and Timed explosions is applied in a radius set by l4d2_flare_gun_distance. The further away someone is the less damage is applied.
  • The Sensor type has a set trigger radius. To change you must edit the source and replace "models/props/cs_assault/box_stack2.mdl" with a new model of different size.
  • Projectiles can ignite players/special infected/explosives when they touch. Damage is applied twice a second on multiple touches and can be controlled by l4d2_flare_gun_hurt and for special infected l4d2_flare_gun_hurt_infected.


Forward:
Spoiler



Player commands:

PHP Code:
sm_flaregun // Opens the Flare Gun menu to select different types. 


CVars:

Saved to l4d2_flare_gun.cfg in your servers \left4dead\cfg\sourcemod\ folder.

PHP Code:
// 0=Plugin off, 1=Plugin on.
l4d2_flare_gun_allow "1"

// 0=Unlimited ammo, 1=Default ammo, else how many grenades are given in Grenade Launchers.
l4d2_flare_gun_ammo "1"

// 0=Off, 1=Display the !flaregun menu when players first pickup Grenade Launchers.
l4d2_flare_gun_auto_menu "1"

// Scales friendly fire damage to other players.
l4d2_flare_gun_damage_ff_scale "0.15"

// Scales friendly fire damage to yourself.
l4d2_flare_gun_damage_ff_self "0.15"

// Maximum damage the Homing Rocket explosions can cause.
l4d2_flare_gun_damage_homing "75.0"

// Maximum damage the Jump explosions can cause.
l4d2_flare_gun_damage_jump "50.0"

// Maximum damage the Remote Bomb explosions can cause.
l4d2_flare_gun_damage_remote "75.0"

// Maximum damage the Sensor Bomb explosions can cause.
l4d2_flare_gun_damage_sensor "75.0"

// Maximum damage the Timed explosions can cause.
l4d2_flare_gun_damage_timed "75.0"

// How far can the explosions cause damage.
l4d2_flare_gun_distance "250.0"

// Changes the projectile bounciness. Valve default: 1.0.
l4d2_flare_gun_elasticity "1.0"

// How much force is applied to the Jump type.
l4d2_flare_gun_force "600.0"

// 0=Off, When using the jump type: 1=Prevent Ledge Grab, 2=Prevent fall damage, 3=Both.
l4d2_flare_gun_god "3"

// Changes the projectile gravity, negative numbers make it fly upward!
l4d2_flare_gun_gravity "0.4"

// 0=Off, Hurt survivors this much and ignite zombies/infected/explosives when bouncing. This enables l4d2_flare_gun_hurt_special.
l4d2_flare_gun_hurt "10"

// Hurt special infected this much when they touch the flare. Damage is limited to once per second, same as above.
l4d2_flare_gun_hurt_special "10"

// Stumble survivors/special infected in explosions (does not affect stock types).
l4d2_flare_gun_hurt_stumble "1"

// Turn on/off the attached light_dynamic glow.
l4d2_flare_gun_light "1"

// The light color. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
l4d2_flare_gun_light_color "200 20 15"

// Max simultaneous flares a player can shoot.
l4d2_flare_gun_max "3"

// Limit the total number of simultaneous grenade flares to this many.
l4d2_flare_gun_max_total "16"

// Players with these flags have access to flare gun type menu. (Empty = All).
l4d2_flare_gun_menu ""

// Players with these flags have access to all the flare gun types in the menu.
l4d2_flare_gun_menu_admin "z"

// 0=Off. 1=Use ZOOM (scope) key to open the menu. Only accessible to players with l4d2_flare_gun_menu flags.
l4d2_flare_gun_menu_button "1"

// Turn on the plugin in these game modes, separate by commas (no spaces). (Empty = all).
l4d2_flare_gun_modes ""

// Turn off the plugin in these game modes, separate by commas (no spaces). (Empty = none).
l4d2_flare_gun_modes_off ""

// Turn on the plugin in these game modes. 0=All, 1=Coop, 2=Survival, 4=Versus, 8=Scavenge. Add numbers together.
l4d2_flare_gun_modes_tog "0"

// 0=Default type on pickup (set to l4d2_flare_gun_type_default cvar). 1=Save previous selection to client preferences.
l4d2_flare_gun_prefs "1"

// 0=No reloading, quick shooting, 1=Default reloading after 1 shot.
l4d2_flare_gun_reload "1"

// 0=Off, 1=Turn on the attached firework particle effect.
l4d2_flare_gun_sparks "1"

// The grenade launcher projectile speed.
l4d2_flare_gun_speed "1000"

// The homing rocket projectile speed.
l4d2_flare_gun_speed_homing "400"

// 0=Off, 1=The Sacrifice flare smoke, 2=Flare smoke but RPG smoke on Bounce type.
l4d2_flare_gun_smoke "1"

// Turn on/off the attached glowing sprite.
l4d2_flare_gun_sprite "1"

// Set the glowing sprite color. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
l4d2_flare_gun_sprite_color "200 20 15"

// How many seconds before removing Bounce projectiles.
l4d2_flare_gun_time_bounce "10.0"

// How many seconds before removing Homing Rockets (explodes on time up).
l4d2_flare_gun_time_homing "10.0"

// How many seconds before removing Jump projectiles.
l4d2_flare_gun_time_jump "60.0"

// How many seconds before removing Remote Bomb projectiles.
l4d2_flare_gun_time_remote "60.0"

// How many seconds before removing Sensor projectiles.
l4d2_flare_gun_time_sensor "30.0"

// How many seconds before removing Sticky Flare projectiles.
l4d2_flare_gun_time_sticky "20.0"

// How many seconds before removing Timed projectiles.
l4d2_flare_gun_time_timed "5.0"

// Which types can players use (admins can use all). 1=Stock, 2=Flare, 4=Bounce, 8=Sticky Flare, 16=Jump, 32=Remote Bomb, 64=Sticky Bomb Timed, 128=Sensor Bomb, 256=Homing Rocket, 511=All.
l4d2_flare_gun_types "239"

// The default type of grenade launcher new players receive. Same as types but only use 1 value, do not add up.
l4d2_flare_gun_type_default "2"

// Flare Gun plugin version.
l4d2_flare_gun_version 


Changes:

Code:
2.16 (05-Sep-2023)
    - Fixed the plugin stumbling players when the stumble option is turned off. Thanks to "Proaxel" for reporting.

2.15 (25-May-2023)
    - Fixed cvars "l4d2_flare_gun_prefs" and "l4d2_flare_gun_type_default" not being followed. Thanks to "Voevoda" for reporting.
    - Fixed rare invalid entity error. Thanks to "Voevoda" for reporting.

2.14 (11-Dec-2022)
    - Changes to fix compile warnings on SourceMod 1.11.

2.13a (24-Feb-2021)
    - Added Simplified Chinese and Traditional Chinese translations. Thanks to "HarryPotter" for providing. 

2.13 (01-Oct-2020)
    - Added forward "OnFlareGunProjectile" to notify plugins when a modified Grenade Launcher projectile was created.
    - Fixed compile errors on SM 1.11.

2.12 (05-Sep-2020)
    - Fixed cvar "l4d2_flare_gun_menu" not restricting menu access.
    - Defaults to checking "sm_flaregun" SM command override if no cvar value is set.
    - The cvar "l4d2_flare_gun_menu_admin" now checks SM command override if no cvar value is set.
    - Thanks to "maclarens" for reporting.

2.11 (15-May-2020)
    - Better cookies and admin checks.
    - Replaced "point_hurt" entity with "SDKHooks_TakeDamage" function.

2.10 (10-May-2020)
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.
    - Various changes to tidy up code.
    - Various minor optimizations.

2.9 (09-Apr-2020)
    - Added cvar "l4d2_flare_gun_prefs" to set client preferences on or off. Thanks to "Voevoda" for requesting.

2.8 (01-Apr-2020)
    - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.
    - Fixed not precaching "env_shake" which caused stutter on first explosion.
    - Removed "colors.inc" dependency.
    - Updated these translation file encodings to UTF-8 (to display all characters correctly): German (de).

2.7.5 (30-Oct-2019)
    - Fixed the grenade launcher exploding next to players after a map transition.
    - Some optimizations and fixes.

2.7.4 (03-Jul-2019)
    - Fixed minor memory leak when using the Homing Type.

2.7.3 (27-Jun-2019)
    - Changed PrecacheParticle method.

2.7.2 (01-Jun-2019)
    - Changed from RequestFrame to SpawnPost, for better response when projectiles are created.
    - Removed gamedata signature/SDKCall dependency for stagger. Thanks to Lux editing Airstrike plugin.
    - Now uses native VScript API for stagger function thanks to Timocop's function and Lux reporting.

2.7.1b (18-Feb-2019)
    - Changed the gamedata to be compatible with plugins that detour the OnStaggered function.

2.7.1 (21-Jul-2018)
    - Changed from CreateTimer to RequestFrame, for faster response when projectiles are created.
    - Added compatibility for my modified version of the "Helicopter Gunship" plugin.

2.7 (05-May-2018)
    - Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.

2.6 (01-Apr-2018)
    - Added cvar "l4d2_flare_gun_menu_button" to enable opening the menu instead of using the console command.
    - Attempt to fix godmode bug.

2.5 (06-Jul-2013)
    - Gamedata signatures file updated. No other changes.

2.5 (27-May-2012)
    - Fixed the damage cvars not applying full damage to special infected - Thanks to "disawar1" for bug report.

2.4 (25-May-2012)
    - Fixed the Timed Bomb type not following the damage cvar settings.
    - Fixed the Homing Type breaking the total number of projectiles.

2.3 (20-May-2012)
    - Fixed errors reported by "Dont Fear The Reaper".
    - New gamedata "l4d2_flare_gun.txt" file required.
    - The cvar "l4d2_flare_gun_hurt_stumble" now stumbles survivors and infected away from the explosion origin.

2.2 (10-May-2012)
    - Added "Homing" type to direct the projectile movement.
    - Added cvar "l4d2_flare_gun_modes_off" to control which game modes the plugin works in.
    - Added cvar "l4d2_flare_gun_modes_tog" same as above.
    - Added cvar "l4d2_flare_gun_god" to prevent ledge grab and fall damage when using the Jump type.
    - Added cvar "l4d2_flare_gun_damage_homing" to control the Homing Rocket explosion damage.
    - Added cvar "l4d2_flare_gun_time_homing" to control how long the Homing Rocket lasts.
    - Added cvar "l4d2_flare_gun_speed_homing" to control how fast Homing Rockets travel.
    - Prevents shooting the Grenade Launcher when limiting the number of projectiles.
    - Should no longer explode when using a sticky type too close to a wall.
    - Small changes and fixes.

2.1 (11-Jan-2012)
    - Fixed a bug in the menu which gave the wrong Flare Gun type to non-admins.
    - Increased a string size to better support translations.

2.0 (01-Jan-2012)
    - Plugin separated and taken from the "Flare and Light Package" plugin.
    - Added Jump type which launches players into the air.
    - Added Remote type which sticks and detonates when players right click (shove).
    - Added Sensor Bomb type which detonates when infected or special infected go near.
    - Added Sticky type which sticks and has no explosion.
    - Added Timed bombs which detonate after l4d2_flare_gun_time_timed.
    - Added and changed many cvars.
    - Changed the command "sm_flaregun" to show players a menu of Grenade Launcher types.
    - Changed the cvar "l4d2_flare_gun_type", add the numbers together to choose allowed Grenade Launcher types for non-admins.
    - Changed cvar "l4d2_flare_gun_max" to limit how many simultaneous flares players are allowed. (Admins limited by cvar below).
    - Added cvar "l4d2_flare_gun_max_total" to limit the total amount of flares at one time.
    - Projectiles which have been shot after the max limits will be removed.
    - Removed cvar "l4d2_flare_gun_bounce".
    - Removed cvar "l4d2_flare_gun_time".

1.0.3 (10-Mar-2012)
    - Added "l4d2_flare_gun_bounce 3" to make grenade launcher projectiles stick to surfaces.
    - Added "l4d2_flare_gun_bounce 4" to do the same as above and explode after "l4d2_flare_gun_time".
    - Added a new cvar to change the grenade launcher projectile bounciness (l4d2_flare_gun_elasticity).

1.0.2 (30-Jan-2012)
    - Fixed the Flare Gun hint text displaying when the game mode is disallowed.

1.0.1 (29-Jan-2012)
    - Fixed Flare Gun hint text displaying when Flare Gun is off.
    - Change the default Flare Gun Speed (l4d2_flare_gun_speed) cvar from 600 to 1000.

1.0 (29-Jan-2011)
    - Initial release.


Compiling:
  1. Put the plugins .sp file into your scripting folder and compile the plugin.


Installation:
  1. Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder.

Updating from 2.8 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), Russian (ru), Simplified Chinese (zho), Spanish (es), Traditional Chinese (chi).
Attached Files
File Type: zip l4d2_flare_gun.zip (53.0 KB, 269 views)
__________________

Last edited by Silvers; 09-05-2023 at 13:06.
Silvers is offline