Raised This Month: $ Target: $400

[L4D & L4D2] Lock Doors (1.21) [11-Dec-2022]

Thread Tools Display Modes
Prev Previous Post   Next Post Next
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
Plugin Version:
Plugin Category:
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    Plugin Description:
    Replicates an old feature Valve removed, allowing players to lock and unlock doors. Also sets open/closed/locked doors health.
    Old 04-07-2020 , 04:22   [L4D & L4D2] Lock Doors (1.21) [11-Dec-2022]
    Reply With Quote #1

    • Valve had originally released or were planning on implementing the ability for Survivors to lock doors.
    • This plugin brings that to life with additional features.
    • Doors can be randomly opened or closed on round start with the cvar l4d_lock_doors_random - respects Versus competitive balance.
    • Customise the health of doors when they spawn, are opened, closed or locked.
    • This will not affect saferoom doors or existing locked doors to avoid breaking certain maps.
    • Keybind: Shift + E or Ctrl + E set by l4d_lock_doors_keys cvar.
    • Don't change the health cvars during gameplay as the plugin relies on the original values to restore health!

    • Cuba - For the request.
    • Lux - As standard.
    • gongo - Lots of help testing.
    • Toranks - Lots of help testing.

    Admin Commands: (requires "z" flag)

    PHP Code:
    sm_doors_random   // Randomly opens or closes doors based on the random cvar settings. This will mess up Versus saving and restoring.
    sm_doors_health   // Returns the health of the door you're aiming at.
    sm_doors_glow     // Debug testing command to show all doors.
    sm_doors_close    // Closes all doors on the map.
    sm_doors_open     // Opens all doors on the map.
    sm_doors_tog      // Toggle state of all doors on the map.
    sm_doors_vs       // Toggle all doors testing for Versus save and restore. 


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

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

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

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

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

    // 0=Default game damage. Amount of damage to cause to doors when shoved by a Common Infected.
    l4d_lock_doors_damage_common "250"

    // 0=Default game damage. Amount of damage to cause to doors when shoved by a Special Infected.
    l4d_lock_doors_damage_infected "250"

    // 0=Default game damage. Amount of damage to cause to doors when shoved by a Tank.
    l4d_lock_doors_damage_tank "0"

    // 0=Default game damage. Amount of damage to cause to doors when shoved by a Survivor.
    l4d_lock_doors_damage_survivor "250"

    // 0=Off. Percentage of health to set when the door is locked.
    l4d_lock_doors_health_lock "2.0"

    // 0=Off. Percentage of health to set when the door is open.
    l4d_lock_doors_health_open "0.5"

    // 0=Off. Percentage of health to set when the door is shut.
    l4d_lock_doors_health_shut "1.0"

    // 0=Off. How much health doors have on spawn (840 game default on some maps).
    l4d_lock_doors_health_total "840"

    // 0=No invincible doors. 1=Allow doors which are damaged when shot etc but don't break (default game behaviour).
    l4d_lock_doors_invincible "0"

    // 0=Off (no locking doors). 1=Shift (walk) + E (use). 2=Ctrl (duck) + E (use). Which key combination to lock/unlock doors.
    l4d_lock_doors_keys "1"

    // 0=Off. 1=Maps listed in the data config will allow the plugin to work. 2=Maps listed in the data config will block the plugin from working.
    l4d_lock_doors_map_block "2"

    // 0=Off. On round start the chance out of 100 to randomly open or close a door. Versus 2nd round will open/close the same doors. Requires the Left4DHooks plugin.
    l4d_lock_doors_random "0"

    // 1=Open doors only. 2=Close doors only. 3=Open doors that are closed, and close doors that are open. When used with the random cvar.
    l4d_lock_doors_random_type "1"

    // 0=Any distance. How close a player must be to the door they're trying to lock or unlock.
    l4d_lock_doors_range "150"

    // 0=Off. Display a chat message when: 1=Locking doors. 2=Unlocking doors. 4=To all players. 8=To self. Add numbers together.
    l4d_lock_doors_text "7"

    // 0=Off. Vocalize when locking doors.
    l4d_lock_doors_vocalize "1"

    // Lock Doors plugin version

    1.21 (11-Dec-2022)
        - Fixed an invalid handle error.
    1.20 (09-Jul-2022)
        - Fixed sometimes ignoring blocked door models when using random doors. Thanks to "gongo" for reporting.
    1.19 (05-Jul-2022)
        - Fixed random doors not working in L4D1 and throwing errors. Thanks to "gongo" for reporting.
        - Fixed bug detecting tanks in L4D1 or regarding Jockey's as tanks in L4D2.
    1.18 (26-Jun-2022)
        - Added command "sm_doors_random" to randomly open or close doors based on the random cvar settings.
        - Increased the range of rescue door detection to prevent opening some rescue closets. Thanks to "gongo" for reporting.
        - Blocked another model from being used by the plugin (c5m2_park) which prevented common spawning. Thanks to "gongo" for reporting.
    1.17 (24-Jun-2022)
        - Fixed health bugs under certain conditions. Thanks to "gongo" for reporting.
        - Fixed bots from locking doors. They can still unlock them instead of teleporting through locked doors.
        - Now supports all 3rd party maps for the "random" feature of opening/closing doors on round start.
        - Now fully supports unloading and late loading the plugin. Random doors will not change when late loading.
        - Renamed command "sm_lock_doors_health" to "sm_doors_health".
    1.16 (16-Jun-2022)
        - Added more models to be ignored by the plugins features.
        - Plugin now ignores outhouse and gun cabinet doors.
        - Added an optional data config to specify maps the plugin should be allowed or blocked on, depending on the new cvar value.
        - Added cvar "l4d_lock_doors_map_block" to allow or block the plugin working on the maps listed in the data config.
        - Fixed rare bug causing all doors to be unusable.
        - Fixed setting double doors health to the wrong values when using the random cvar.
        - L4D2: Fixed random doors not working on the 3rd party map "The Hive" chapter 1.
        - L4D2: Fixed the map "CEDA Fever" chapter 1 intro missing the "gameinstructor_draw" event, which prevented random doors from working.
        - Thanks to "gongo" for reporting and lots of help testing.
    1.15 (05-Jun-2022)
        - Added commands "sm_doors_close", "sm_doors_open" and "sm_doors_tog" to control all doors.
    1.14 (03-Jun-2022)
        - Changed cvar "l4d_lock_doors_keys" to accept the value of "0" to disable the locking and unlocking doors feature.
        - Really fixed doors not randomly opening or closing on new campaigns. Thanks to "gongo" for help.
    1.13 (01-Jun-2022)
        - Added command "sm_doors_glow" to make doors glow, for debug testing.
        - Fixed potentially not finding some relative double doors.
    1.12 (01-Jun-2022)
        - Fixed not finding relative double doors that used only identical targetnames to match. Thanks to "gongo" for reporting.
    1.11 (01-Jun-2022)
        - Added cvar "l4d_lock_doors_random_type" to set if doors should be randomly opened or closed only, or toggled by their current state.
        - Fixed not always opening or closing doors on round restarts. Thanks to "gongo" for reporting.
        - Restored ability to lock alarmed doors, but plugin no longer randomly opens them. Thanks to "Toranks" for reporting.
    1.10 (30-May-2022)
        - Added cvar "l4d_lock_doors_invincible" to control if invincible doors should be allowed (stock game function).
        - Fixed affecting some doors which should be closed for events etc.
        - Fixed double doors not always opening in the same direction.
        - Fixed potentially not working on some round restarts.
    1.9 (30-May-2022)
        - Added cvar "l4d_lock_doors_damage_tank" to control a Tanks shove damage on doors.
        - Now requires double doors to be closed before locking.
        - Fixed the damage cvars not following the "0" value to use default game damage.
        - Fixed some doors sometimes becoming invincible and not breaking.
        - Fixed another case where random doors were not set after server start.
    1.8 (29-May-2022)
        - Added cvars "l4d_lock_doors_damage_common", "l4d_lock_doors_damage_infected" and "l4d_lock_doors_damage_survivor" to control shove damage on doors. Thanks to "Maur0" for reporting.
        - Added support for competitive Versus to open/close the same doors for both teams.
        - Now ignores randomly opening a door if it's near an "info_survivor_rescue" entity. Thanks to "gongo" for reporting.
        - Better handling for opening double doors in the same direction, should work in most cases/maps.
        - Fixed accidental additional character in printing message.
        - Fixed not randomly opening or closing doors on server start.
    1.7 (29-May-2022)
        - Fixed cvar "l4d_lock_doors_random" not setting random door positions on round restart. Thanks to "gongo" for reporting.
    1.6 (29-May-2022)
        - Added command "sm_lock_doors_health" to check a doors health.
        - Added cvar "l4d_lock_doors_random" to randomly open or close doors on round start.
        - Fixed the health not being consistently set correctly.
        - Fixed locking or unlocking from opening or closing the door.
        - Fixed issues with double doors not being handled together.
        - Change cvar "l4d_lock_doors_text" description and default value for hint messages printing to all instead of an individual client and vice versa.
        - Thanks to "gongo" for reporting issues and testing.
        - Thanks to "Toranks" for help testing.
    1.5 (20-Jul-2021)
        - Blocked some door models that are missing the door knob animation. Thanks to "sonic155" for reporting.
    1.4 (21-Jun-2021)
        - Added door handle animation and sound when attempting to open a locked door. Requested by "The Renegadist".
    1.3 (18-Aug-2020)
        - Added cvar "l4d_lock_doors_range" to set the distance players must be to lock or unlock doors.
    1.2 (10-May-2020)
        - Extra checks to prevent "IsAllowedGameMode" throwing errors.
        - Various changes to tidy up code.
    1.1 (08-Apr-2020)
        - Changed the lock sound and increased volume.
        - Fixed not working on server start or when the plugin was enabled again. Thanks to "Cuba" for reporting.
    1.0 (07-Apr-2020)
        - Initial Release.

    1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
    2. Optionally download "l4d_lock_doors.cfg" and put into your servers \addons\sourcemod\data\ folder to allow or block the plugin on specific maps.

    Updating from 1.15 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: sp Get Plugin or Get Source (l4d_lock_doors.sp - 482 views - 64.1 KB)
    File Type: cfg l4d_lock_doors.cfg (1.1 KB, 385 views)

    Last edited by Silvers; 12-10-2022 at 21:28.
    Silvers is offline

    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump

    All times are GMT -4. The time now is 12:06.

    Powered by vBulletin®
    Copyright ©2000 - 2023, vBulletin Solutions, Inc.
    Theme made by Freecode