View Single Post
Author Message
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-26-2011 , 12:12   [L4D & L4D2] Extinguisher & Flamethrower (1.23) [25-May-2023]
Reply With Quote #1




About:
  • Read/search this post before asking questions.
  • Allows the Fire Extinguisher props to be used as a weapon.
  • Use the Extinguisher while incapped and refuel with gascans.
  • Commands to save and position extinguishers on maps for auto spawning.
  • Data config included with Extinguishers placed on every Valve map.
  • Lots of cvars to customise.


Thanks:

Bugs:
  • Can block the USE button when equipped in hand (due to the model blocking the view, nothing can be done).
  • Model not attached to weapon in first person view. Cvar to turn off the extinguisher view.
  • This console message can be ignored: "Setting CBaseEntity to non-brush model models/props/cs_militia/silo_01.mdl".
  • L4D1 characters and Louis in L4D2 are missing valid weapon attachment points so the extinguisher model is not fixed to the hand in thirdperson.
  • Glow color is only available in L4D2.
  • Refueling is only available in L4D2.


Dropping and Refueling:
  • With the extinguisher equipped in hand, you can press the RELOAD (r) key to drop it. Also by typing !dropext in chat or sm_dropext in console.
  • To refuel, drop an extinguisher and pickup a gascan. Aim at the extinguisher and hold SHOOT (mouse1), you may have to move the crosshair/yourself for it to start refueling.
  • Scavenge Score Fix - Gascan Pouring - Get this plugin to prevent bugs when refueling with gascans on certain maps/gamemodes.


Types:
You can change which types are allowed by adding together the numbers to make the cvar: l4d_extinguisher_type.

1. Extinguisher:
This can be used to extinguish molotovs and exploding barrels, firework explosions and/or spitter acid. Set l4d_extinguisher_spray to choose which types it works on. This will also extinguish special infected from fire.

2. Flamethrower:
Use this to ignite all zombies, gascans, firework crates, propane and oxygen tanks.

4. Freezer Spray:
When sprayed on common infected, they will appear with a blue glow and will be slowed down, especially when shoved and falling. This will also extinguish special infected from fire.

8. Blastpushback:
When sprayed on survivors or special infected, they will be pushed backwards. Note: Each blast uses 25 fuel set by l4d_extinguisher_push_fuel and has a timeout after using set by l4d_extinguisher_push_time.


Combo Cvar:
If you want all extinguisher types on a single extinguisher, set the cvar l4d_extinguisher_combo to anything but 0. The value sets the glow color. The following types are controlled by the keys listed.
  1. Flamethrower - IN_ATTACK (primary attack/mouse1 button)
  2. Extinguisher/Freezerspray - IN_ZOOM (sniper scope/middle mouse button)
  3. Blastpushback - IN_SPEED (walk/shift key) and IN_ZOOM (scope/mmb)


Weapon Replacement:
You can set the extinguisher to only work when players have a specific weapon in hand by setting the cvar l4d_extinguisher_weapon to the weapon entity name. For example "weapon_rifle_ak47" for the AK47. You should update the translation file (the one which is your servers default language) with the weapon name where the "Ext_WeaponName" entry is listed.

To ensure they only have extinguishers equipped when they have this weapon set the cvar l4d_extinguisher_check to 1.

If you would like the extinguisher to work when any pistol/primary weapon is equipped:
  1. Set the cvar l4d_extinguisher_weapon to ""
  2. Set the cvar l4d_extinguisher_check to 0.


Public Commands:
PHP Code:
sm_dropext    // Drops an equipped extinguisher. Admins usage: sm_dropext <#userid|name>. No arguments = self. 

Admin Commands: (requires "z" flag)
PHP Code:
sm_giveext    // Gives extinguisher. Usage: sm_giveext <1|2|3|4> (give to self, where 1=Extinguisher, 2=Flamethrower, 3=Freezerspray, 4=Blast Pushback) or <#userid|name> <type: 1|2|3|4>
sm_spawnext   // Spawns an extinguisher at your crosshair location. Usage: sm_spawnext <1|2|3|4> (1=Extinguisher, 2=Flamethrower, 3=Freezerspray, 4=Blast Pushback)
sm_extwep     // Gives the l4d_extinguisher_weapon to the target player(s). Usage: sm_extwep <#userid|name>. No arguments = self.
sm_extsave    // Spawns a extinguisher at your crosshair and saves to config. Usage: sm_extsave <1|2|4|8> 1=Extinguisher, 2=Flamethrower, 4=Freezerspray, 8=Blast Pushback, 15=Any.
sm_extang     // Set angle of extinguisher behind crosshair. Only works on sm_extsave extinguishes.
sm_extpos     // Set position of extinguisher behind crosshair. Only works on sm_extsave extinguishes.
sm_extset     // Save to the config the ang/pos of extinguisher behind crosshair if spawned with sm_extsave.
sm_extdel     // Removes the extinguisher your crosshair is pointing at.
sm_extclear   // Removes all fire extinguishers from the current map (except those equipped by players).
sm_extwipe    // Removes all fire extinguisher from the current map and deletes them from the config.
sm_extlist    // Display a list extinguisher positions and the number of extinguishers.
sm_extglow    // Toggle to enable glow on all extinguishers to see where they are placed. 

CVars:

Saved to l4d_extinguisher.cfg in your servers \cfg\sourcemod\ folder.

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

// 0=No break, 1=Valve default breaks when damaged, 2=Breaks and cannot be used, 3=Same as 2 but special infected can't break.
l4d_extinguisher_break "2"

// Players must have the l4d_extinguisher_weapon to equip and use Extinguishers.
l4d_extinguisher_check "0"

// 0=Off. Otherwise all Extinguisher functions in one. Sets the Extinguisher glow color. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
l4d_extinguisher_combo "255 255 255"

// How much damage the Extinguisher does per touch when fired. Triggered according to frequency cvar.
l4d_extinguisher_damage "1"

// Flamethrower particles and glow. 0=Flame type A, 1=Flame type B, 2=Type A + Light, 3=Type B + Light.
l4d_extinguisher_flame "2"

// How often the damage trace fires, igniting entities etc.
l4d_extinguisher_frequency "0.1"

// 0=Off, 1=Friendly fire, allow survivors to hurt each other, 2=Only hurt survivors from the Blast type.
l4d_extinguisher_friendly "1"

// 0=Infinite, How much fuel each Extinguisher has. Consumption is based on how often the PreThink fires.
l4d_extinguisher_fuel "1000"

// 0=Glow Off. Any other value sets the range at which extinguishers glow.
l4d_extinguisher_glow "150"

// 0=Valve default. Any other value sets glow color for blast pushback.
l4d_extinguisher_glow_blast "255 255 0"

// 0=Valve default. Any other value sets glow color for extinguishers.
l4d_extinguisher_glow_extin "0 255 0"

// 0=Valve default. Any other value sets glow color for flamethrowers.
l4d_extinguisher_glow_flame "255 0 0"

// 0=Valve default. Any other value sets glow color for freezer sprays.
l4d_extinguisher_glow_spray "0 150 255"

// 0=Off, How many pre-existing extinguishers on maps can this plugin cater for.
l4d_extinguisher_grab "32"

// 0=Off, 1=Display hints from translation file, 2=Displays hints except when the Extinguisher is broken.
l4d_extinguisher_hint "1"

// 0=Off, 1=Allow the Extinguisher to be used when incapacitated.
l4d_extinguisher_incap "1"

// Maximum number of players allowed to have the Extinguisher at once.
l4d_extinguisher_max "0"

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

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

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

// When hit by the blast type, push players/infected by this much force.
l4d_extinguisher_push "400"

// 0=Infinite, How much fuel to take away when using the blast pushback type.
l4d_extinguisher_push_fuel "25"

// How long after using the blast pushback type before it can be used again.
l4d_extinguisher_push_time "0.5"

// 0=Off, -1=All, any other value sets how many randomly auto spawn from the config.
l4d_extinguisher_random "1"

// How far the Extinguisher can affect entities.
l4d_extinguisher_range "150"

// 0=Off, 1=Remove extinguishers after being broken, 2=Remove when out of fuel, 3=Remove when broken or out of fuel.
l4d_extinguisher_remove "0"

// What can be extinguished with the Extinguisher type? 1=Molotovs/Barrels, 2=Firework Explosions, 4=Spitter Acid, 7=All.
l4d_extinguisher_spray "7"

// How long players have to shoot the Extinguisher type when standing in a fire before it can be removed.
l4d_extinguisher_time "8"

// How long does it take to pick up extinguishers.
l4d_extinguisher_timed "1.0"

// How long after using the Extinguisher till you can use it again.
l4d_extinguisher_timeout "0.2"

// Which types are allowed: 1=Extinguisher, 2=Flamethrower, 4=Freezer spray, 8=Blast, 15=All.
l4d_extinguisher_type "15"

// When clients hold the Extinguisher: 0=Show it, 1=Show it and hide their weapon, 2=Show their weapon and hide the Extinguisher.
l4d_extinguisher_view "1"

// Remove boomer vomit effect from players  on the first spray. 0=Off, 1=Extinguisher, 2=Flamethrower, 4=Blast type, 7=All.
l4d_extinguisher_vomit "5"

// ""=All (must set l4d_extinguisher_check to 0). Weapon entity name to replace and use for the Extinguisher.
l4d_extinguisher_weapon ""

// Extinguisher plugin version.
l4d_extinguisher_version 


Changes:
Code:
1.23 (25-May-2023)
    - Made the last change compatible with L4D1. Thanks to "Ja-Forces" for reporting.

1.22 (31-Mar-2023)
    - Changed the method for detecting nearby fires to be accurate and not within a certain range. Fixes fires not extinguishing when they spread out.
    - Changed cvar "l4d_extinguisher_incap" adding option "2" supporting the "Incapped Weapons" plugin.
    - Fixed not being able to use the extinguisher when someone is healing you.
    - Fixed the weapon showing after crawling while incapped and holding an Extinguisher.
    - Thanks to "swiftswing1" for the bug reports and testing.

1.21 (20-Jun-2022)
    - Extinguisher is now blocked when "using" something, e.g. buttons.

1.20 (15-Jun-2022)
    - Made refueling with gascans compatible with the "Scavenge Pouring - Unleaded Gas Only" plugin.

1.19 (01-Mar-2022)
    - Changed where sounds are played so they're clearer and louder. Thanks to "swiftswing1" for reporting.
    - Fixed Spanish translation. File "translations/es/extinguisher.phrases.txt" has been updated. Thanks to "swiftswing1" for reporting.

1.18 (19-Oct-2021)
    - Fixed the extinguisher equipping over the Chainsaw. Thanks to "swiftswing1" for reporting.
    - Fixed zooming sniper scopes when using the zoom button with an extinguisher equipped. Thanks to "swiftswing1" for reporting.
    - Zooming still occurs for a split second. Would probably require detouring "CTerrorGun::CanZoom" or something similar to totally block.
    - Changed some code which only works in SM 1.10 or newer.

1.17 (11-Jul-2021)
    - L4D2: Fixed not attaching the Extinguisher correctly to "Coach" and some L4D1 characters in L4D2. Probably broken in game recent updates.

1.16 (01-Jul-2021)
    - Added a warning message to suggest installing the "Scavenge Score Fix - Gascan Pouring", "Attachments API" and "Use Priority Patch" plugins if missing.
    - Increased the range of which you can extinguish fires from. Thanks to "mikaelangelis" for reporting and testing.

1.15 (15-Feb-2021)
    - Fixed "Cannot create new entity when no map is running" error. Thanks to "Dragokas" for reporting.
    - Fixed "Property "m_flFrozen" not found" error. Thanks to "Mi.Cura" for reporting and "Marttt" for fixing.

1.14 (30-Sep-2020)
    - Fixed compile errors on SM 1.11.

1.13 (15-Jul-2020)
    - Fixed players getting stuck when an extinguisher breaks during pick up. Thanks to "xZk" for reporting.
    - Fixed L4D1 throwing errors from blocking glow cvars. Thanks to no one for reporting.
    - Made compatible with the "Weapon Charms" plugin version 1.7+ only.

1.12 (15-May-2020)
    - Fixed the Blast Pushback type not flinging players when they are too close.
    - Fixed the Extinguisher not displaying after reviving someone.
    - Replaced "point_hurt" entity with "SDKHooks_TakeDamage" function.

1.11 (10-May-2020)
    - Added better error log message when gamedata file is missing.
    - Blocked glow convars being generated for L4D1 which does not support glows.
    - Fixed Blast Pushback type making players stumble instead of throwing them due to 1.9.2 changes.
    - Various changes to tidy up code.
    - Various optimizations and fixes.

1.10 (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): Danish (da), German (de).

1.9.3 (04-Mar-2020)
    - Minor changes to source, has no affect.

1.9.2 (10-Oct-2019)
    - Fixed entity leak - not deleting an entity after use.
    - Blast Pushback now pushes Common and Witches away.

1.9.1 (28-Jun-2019)
    - Changed PrecacheParticle method.

1.9 (05-May-2018)
    - Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
    - Changed cvar "l4d_extinguisher_modes_tog" now supports L4D1.

1.8.4 (12-Jun-2015)
    - Fixed the plugin not compiling on SourceMod 1.7.x.

1.8.3 (18-Aug-2013)
    - Fixed the Extinguisher being active when using a mounted gun. - Thanks to "Herbie" for reporting.

1.8.2 (21-Jul-2013)
    - Removed Sort_Random work-around. This was fixed in SourceMod 1.4.7, all should update or spawning issues will occur.

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

1.8.1 (07-Oct-2012)
    - Fixed the Extinguisher blocking players +USE by adding a single line of code - Thanks to "Machine".

1.8 (10-Jul-2012)
    - Fixed hurting players behind you.

1.7 (25-May-2012)
    - Added cvar "l4d_extinguisher_vomit" to remove the boomer vomit effect when first spraying survivors.
    - Fixed the Extinguisher type not causing damage when combo cvar was set to 0.
    - Fixed Louis and Zoey effects spraying in the wrong direction in L4D2.

1.6 (21-May-2012)
    - Added German translations - Thanks to "Dont Fear The Reaper".

1.6 (10-May-2012)
    - Added cvar "l4d_extinguisher_time" to control how long players have to shoot when standing in fire before removing it.
    - Fixed the fires not being removed properly.
    - Fixed the extinguisher not appearing after throwing held objects.
    - Fixed refuel hints displaying in L4D1, refilling with gascans cannot work in L4D1.
    - Small changes.

1.5 (30-Mar-2012)
    - Added cvar "l4d_extinguisher_modes_off" to control which game modes the plugin works in.
    - Added cvar "l4d_extinguisher_modes_tog" same as above, but only works for L4D2.
    - Changed cvar "l4d_extinguisher_hint" added options 3 and 4.
    - Fixed errors the last update caused when Exintguishers were broken by things such as molotovs.
    - Fixed hookevent errors in L4D1, refilling with gascans cannot work in L4D1.
    - Fixed not being able to use pistols when incapped and being revived.
    - Fixed the extinguisher not showing in first person view when equipped after being snared or incapped.
    - Fixed a bug where deleting Extinguishers would also delete "type" entries.
    - Made it easier to extinguish fires by increasing the range which is detected.
    - Optimized the plugin by only creating PreThink hooks when Extinguishers/Gascans are equipped.
    - Optimized the plugin by not detecting the creation of prop_physics models.
    - Stopped setting freezerspray glow on common infected which already have a glow enabled.

1.4 (01-Dec-2011)
    - Fixed players getting stuck when an Extinguisher is broken and they are picking it up.

1.3 (01-Dec-2011)
    - Added Extinguishers to these maps: Crash Course, Death Toll, Dead Air, Blood Harvest, Cold Stream.
    - Added Russian translations - Thanks to "disawar1".
    - Added cvar l4d_extinguisher_incap so the Extinguisher can be used when incapacitated.
    - Added a new translation to notify players they can use the Extinguisher while incapped, if enabled.
    - Added a new translation when the Extinguisher is empty notifying players they can refuel with gas cans.
    - Fixed being able to use the Extinguisher while ridden by a jockey.
    - Fixed l4d_extinguisher_max cvar, limiting how many extinguishers can be used simultaneously.
    - Fixed the Extinguisher attachment position on Zoey.
    - Hides the Extinguisher from a players personal view when not equipped.
    - Made the translation files a requirement for the plugin to work error free.
    - Removed slot cvar. Picking up Extinguishers with pistols uses that slot. Other items default to the primary slot.

1.2 (01-Jul-2011)
    - Added refueling of dropped extinguishers.
    - Added new translations for the above.

1.1 (28-Jun-2011)
    - Fixed the type cvar not setting correctly when combo cvar was enabled.
    - Removed bad spawns from the data config.

1.0 (26-Jun-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.
  2. (L4D2 only) Scavenge Score Fix - Gascan Pouring - Get this plugin to prevent bugs when refueling with the gascan on certain maps/gamemodes.
  3. Install the Use Priority Patch plugin to prevent blocking +USE.
  4. Optional: Install the Attachment_API plugin to fix attachment positions breaking on model change.

Updating from 1.2 or older:
  • You must download and update with the new translation files.
Updating from 1.6 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), Chinese (chi), Chinese Traditional (zho), Danish (da), German (de), Russian (ru), Spanish (es).
Attached Files
File Type: zip l4d_extinguisher.zip (88.4 KB, 449 views)
__________________

Last edited by Silvers; 05-24-2023 at 20:55.
Silvers is offline