View Single Post
Author Message
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-17-2011 , 13:23   [L4D2] Footlocker Spawner (1.19) [22-Nov-2023]
Reply With Quote #1

Related Plugins:


About:
  • Auto spawns footlockers from a config on round start.
  • Config included with footlockers on every Valve map (apart from The Passing and most finales).
  • Specify which items can spawn and how many. No support for other items or weapons. Please do not request.
  • Versus and scavenge games spawn the same footlockers and items for both teams (except Witch).


Thanks:
  • alexip121093 - For the idea and HookEntityOutput code and help testing.
  • Boikinov, Zuko & McFlurry for source code (full credits inside the source).
  • Zergling89 - Testing.
  • ZombieAssassinator - Testing.
  • Mr.RuyC - Testing.
  • JoBarfCreepy - Testing.
  • disawar1 - Testing and reporting bugs.
  • Mr. Man - Testing.
  • recon-1 - Testing.
  • bubbabyte - Testing and reporting bugs.
  • Accelerator74 - Testing and reporting bugs.


Information:
  • In Hard Rain all spawned Footlockers and items (except Firework crates) are saved and created for the return journey.
  • When placing footlockers in Hard Rain, you MUST:
    [1] Copy "c4m1_milltown_a" data to "c4m4_milltown_b" and "c4m5_milltown_escape" (c4m5 if they are in the finale map area).
    [2] Copy "c4m2_sugarmill_a" data to "c4m3_sugarmill_b".


Bugs:
  • Firework crates cannot be picked up on Hard Rain return journey.
  • Do not create temporary footlockers on the Hard Rain outbound journey. This will mess up saving/spawning of footlockers.
  • Engine Error: The server will crash if an item (eg vomitjar) is spawned within another item. This seems to be a problem on Windows only. The error message:
    "models/w_models/weapons/w_eq_bile_flask.mdl (2) at -1.$ -1.$ -1.$ in contact with world (2) at -35.8 14.4 65.0, crash. dist = -1, minq = 100000002004087730000.000000"
  • If this error occurs, please let me know which map and which locker was opened (thats when it happens). This can be caused by spawning temporary lockers on top of items.


Admin Commands:

PHP Code:
sm_locker        // Spawns a footlocker at crosshair. <type: 1=Molotov, 2=Pipebomb, 4=Vomitjar, 8=Adrenaline, 16=Pain Pills, 32=Fireworks crate, w=Witch> <count: 0=infinite>
sm_lockersave    // Same as above. (Lockers cannot be saved with the Witch, the 'w' command is for temporary lockers only.
sm_lockerdel     // Removes the footlocker your crosshair is pointing at.
sm_lockerclear   // Removes the footlockers from the current map only.
sm_lockerwipe    // Removes all footlockers from the current map and deletes them from the config.
sm_lockerglow    // Toggle to enable glow on all footlockers to see where they are placed.
sm_lockerlist    // Display a list footlocker positions and the number of footlockers.
sm_lockertele    // Teleport to a footlocker (Usage: sm_lockertele <index: 1 to MAX_FOOTLOCKERS>). 


Cvars:

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

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

// 0=Off. Any other value is the range at which the glow will turn on.
l4d2_footlocker_glow "100"

// 0=Default glow color. Three values between 0-255 separated by spaces. RGB Color255 - Red Green Blue.
l4d2_footlocker_glow_color "0 255 0"

// 0=Off. 1=Notify to all players in chat who opened the Footlocker.
l4d2_footlocker_hint "1"

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

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

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

// -1=All, 0=Off, Randomly select this many footlockers to spawn from the maps config.
l4d2_footlocker_random "3"

// 0=Off. How many seconds it takes to open a footlocker.
l4d2_footlocker_timed "1"

// How many items can be taken from the locker before it's empty. 0=Infinite.
l4d2_footlocker_total "0"

// Which items can spawn. 1=Molotov, 2=Pipebomb, 4=Vomitjar, 8=Adrenaline, 16=Pain Pills, 32=Fireworks crate. 63=All
l4d2_footlocker_types "63"

// Allows survivors to vocalize when they see a footlocker and open it.
l4d2_footlocker_vocalize "1"

// 0=Off, 1/cvar. The chance of a footlocker containing a witch.
l4d2_footlocker_witch "100"

// Footlocker Spawner plugin version.
l4d2_footlocker_version 


Changes:
Code:
1.19 (22-Nov-2023)
    - Changed to TeleportEntity before DispatchSpawn to prevent crashes. Thanks to "HarryPotter" for reporting.

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

1.17 (27-Oct-2021)
    - Changed the way Firework Crates are spawned to be compatible with "Physics fix" plugin. Thanks to "Marttt" for fixing.

1.16a (23-Feb-2021)
    - Data config updated - removed bad footlocker placement on "c9m1_alleys" map. Thanks to "PEK727" for reporting.

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

1.15 (10-May-2020)
    - Various changes to tidy up code.

1.14 (12-Apr-2020)
    - Extra checks to prevent "IsAllowedGameMode" throwing errors.

1.13 (01-Apr-2020)
    - Fixed "IsAllowedGameMode" from throwing errors when the "_tog" cvar was changed before MapStart.

1.12 (14-Mar-2020)
    - Fixed invalid entity error. Thanks to "sxslmk" for reporting.

1.11 (04-Mar-2020)
    - Fixed potential server hanging/crashing on map change with the error:
        "Host_Error: SV_CreatePacketEntities: GetEntServerClass failed for ent 2."
    - This was caused by spawning the "info_gamemode" entity in OnMapStart. Fixed by adding a 0.1 delay.
    - Thanks to "Xanaguy" and "sxslmk" for reporting.

1.10.3 (14-Aug-2018)
    - Another fix attempt for incorrect items spawning, tested on coop/versus/hard rain.
    - Fixed "Inserted func_button with no model" error when pressing a button.

1.10.2 (18-Jun-2018)
    - Fixed spawning items not working correctly. Thanks to "Accelerator74" for reporting and testing.

1.10.1 (17-May-2018)
    - Fixed array index error, which broke spawning items in versus. Thanks to "Accelerator74" for reporting.

1.10.0 (05-May-2018)
    - Converted plugin source to the latest syntax utilizing methodmaps. Requires SourceMod 1.8 or newer.
    - Changed: Versus and scavenge games now spawn the same footlockers and items for both teams (except Witch).

1.9.2 (14-Jun-2015)
    - Fixed "Client index is invalid" errors.

1.9.1 (13-Apr-2015)
    - Fixed the plugin not compiling on SourceMod 1.7.x.

1.9 (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 (02-Jun-2012)
    - Fixed the last update breaking a patch for the "Gear Transfer" plugin removing items.

1.7 (01-Jun-2012)
    - Added cvar "l4d2_footlocker_glow_color" to set the glow color.
    - Fixed items not respawning after being taken.
    - Fixed the witch sometimes getting stuck inside the Footlocker.
    - More prevention for players getting stuck inside the Footlocker.

1.6 (26-May-2012)
    - Fixed witch blocking players or disappearing.

1.5 (10-May-2012)
    - Added command "sm_lockerang" to change the cabinet angle.
    - Added command "sm_lockerpos" to change the cabinet origin.
    - Added cvar "l4d2_footlocker_modes_off" to control which game modes the plugin works in.
    - Added cvar "l4d2_footlocker_modes_tog" same as above.
    - Added cvar "l4d2_footlocker_hint" to notify players who opened the footlocker.
    - Changed cvar "l4d2_footlocker_modes" to enable the plugin on specified modes.
    - Fixed another bug with the witch and firework crates.
    - Removed max entity check and related error logging.

1.4 (01-Mar-2011)
    - Fixed firework crates spawning when a witch spawns.

1.3 (14-Jan-2012)
    - Fixed the cvar "l4d2_footlocker_random" to actually work.

1.2 (01-Dec-2011)
    - Incompatibility: If you use Gear Transfer, you must update to 1.5.7 or greater.
    - Added Footlockers to these maps: Crash Course, Death Toll, Dead Air, Blood Harvest, Cold Stream.
    - Added command "sm_lockerclear" to remove all Footlockers from the current map.
    - Added cvar "l4d2_footlocker_allow" to enable or disable the plugin.
    - Changed cvar "l4d2_footlocker_random", 0 turns off spawning random footlockers, -1 spawns all.
    - Fixed server crashes due to the removal of *_spawn items.
    - Fixed adrenaline and pills not dispensing unlimited items.
    - Pushes players away if they are too close when opening footlockers to avoid them getting stuck.
    - Stopped respawning items on Hard Rain in Versus and Scavenge modes.

1.1 (22-May-2011)
    - Added cvar "l4d2_footlocker_timed" to set how many seconds it takes to open a footlocker.

1.01 (17-May-2011)
    - Stopped L4D1 characters from vocalizing (missing audio).

1.0 (17-May-2011)
    - Initial release.


Installation:
  1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
  2. Download "l4d2_footlocker.cfg" and put into your servers \addons\sourcemod\data\ folder.

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.
Attached Files
File Type: cfg l4d2_footlocker.cfg (24.7 KB, 1499 views)
File Type: sp Get Plugin or Get Source (l4d2_footlocker.sp - 369 views - 68.3 KB)
__________________

Last edited by Silvers; 11-22-2023 at 15:59.
Silvers is offline