Raised This Month: $12 Target: $400
 3% 

[L4D2] Switch Upgrade Ammo Types (1.29) [07-Nov-2023]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Plugin ID:
7163
Plugin Version:
1.29
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
    19 
    Plugin Description:
    Switch between normal bullets and upgraded ammo types.
    Old 06-16-2020 , 01:19   [L4D2] Switch Upgrade Ammo Types (1.29) [07-Nov-2023]
    Reply With Quote #1

    About:
    • Allows players press Shift + R to switch between Primary Ammo and Upgraded Ammo.
    • Allows players to carry both upgrade ammo types (Incendiary and Explosive).
    • Both upgrade ammo types keep with the weapon when it's dropped.
    • Upgraded ammo is carried over map transitions or restarts (only in coop/realism modes).
    • This plugin was really complicated to write (6 re-writes) due to multiple ammo bug issues with the engine.


    Incompatible:
    This plugin is incompatible with the following plugins:


    Thanks:
    • strikeraot - For tons of testing and the idea and request.
    • Lux and MasterMind420 - For putting up with my rage while trying to figure out ammo bug issues.
    • Toranks - Spanish translation.
    • NoroHime - Chinese translations.



    CVars:

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

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

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

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

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

    // Allow swapping ammo on: 0=Neither. 1=Grenade Launcher. 2=M60. 3=Both.
    l4d2_switch_ammo_guns "0"

    // Display a hint when taking upgrade ammo about how to use the plugin. 0=Off. 1=Print to Chat. 2=Hint text.
    l4d2_switch_ammo_hint "1"

    // Which key combination to switch ammo. 1=Shift + Reload. 2=Holding Reload key.
    l4d2_switch_ammo_keys "1"

    // 0=Reload shotguns by emptying the clip when changing ammo types. 1=Shotguns will reload 1 bullet before the clip is full.
    l4d2_switch_ammo_reload "1"

    // Switch Ammo Types plugin version.
    l4d2_switch_ammo_version 


    Changes:
    Code:
    1.29 (07-Nov-2023)
        - Fixed not deleting 1 handle on plugin start.
    
    1.28 (19-Sep-2023)
        - Fixed errors when late loading the plugin or enabling during gameplay. Thanks to "Proaxel" for reporting.
    
    1.27 (17-Sep-2023)
        - Fixed the last update accidentally enabling unlimited usage of upgrade ammo piles and removing laser spawns. Thanks to "Proaxel" for reporting.
    
    1.26 (05-Sep-2023)
        - Fixed the Grenade Launcher reloading in 3rd person being broken. Thanks to "Black_Wolf" for reporting.
    
    1.25 (31-Mar-2023)
        - Fixed array out of bounds error. Thanks to "LindaFelicia" for reporting.
    
    1.24 (19-Feb-2023)
        - Fixed errors thrown due to Special Infected being on Survivor team. Thanks to "Voevoda" for reporting.
    
    1.23 (10-Feb-2023)
        - Fixed rare error about invalid entity. Thanks to "sonic155" for reporting.
        - Fixed "Event_WeaponFire" errors when a Special Infected is on Survivor team. Thanks to "Voevoda" for reporting.
    
    1.22 (25-Jan-2023)
        - Plugin now listens for the "upgrade_add" command for adding upgrade ammo.
    
    1.21 (20-Jan-2023)
        - Plugin now switches to an upgraded ammo type if available, when stock ammo is depleted. Thanks to "swiftswing1" for reporting.
        - Plugin now supports dynamic shotgun weapon clip sizes. Optionally uses Left4DHooks to detect clip size.
    
    1.20 (06-Nov-2022)
        - Fixed invalid weapon error. Thanks to "NoroHime" for reporting.
    
    1.19 (10-Oct-2022)
        - Now swaps ammo when holding the reload key when a clip isn't full and normal reloading has begun.
    
    1.18 (03-Oct-2022)
        - Updated translations for holding reload key method of changing ammo.
        - Thanks to "NoroHime" for updating the Chinese translations.
    
    1.17 (30-Sep-2022)
        - Added cvar "l4d2_switch_ammo_keys" to control the key combination for reloading.
        - Setting the cvar as "2" will allow holding Reload to change ammo. Requested by "sonic155".
        - The source contains a "MAX_TIME_KEY_HOLD" define set at 0.5 which controls how long to hold reload.
    
    1.16 (25-Aug-2022)
        - Moved "ammo_pickup" event hook to plugin start, to prevent errors throwing about no active hook.
    
    1.15 (19-Aug-2022)
        - Added GameData file and new feature to reload the gun when changing ammo types. Requested by "Shao".
        - Added cvar "l4d2_switch_ammo_guns" to control if the "Grenade Launcher" or "Rifle M60" ammo can be switched.
        - Changed cvar "l4d2_switch_ammo_reload" to control if shotguns should reload the whole clip or 1 round.
        - Now prevents swapping ammo until the weapon is ready to shoot.
        - Thanks to "Shao" and "Toranks" for testing.
    
    1.14 (12-Aug-2022)
        - Added cvar "l4d2_switch_ammo_reload" to wait for reloading to finish before switch ammo type. Requested by "Shao".
    
    1.13 (16-Jun-2022)
        - Fixed a bug where you couldn't switch to stock ammo. Thanks to "Toranks" for reporting.
    
    1.12 (13-May-2022)
        - Fixed invalid entity error. Thanks to "sonic155" for reporting.
    
    1.11 (02-May-2022)
        - Fixed late loading (turning the plugin off and on again) from not detecting stock ammo when upgrade ammo is equipped.
        - Fixed gaining ammo issue. Thanks to "Toranks" for reporting and testing.
        - Weapon now switches to upgrade ammo if available when no stock ammo remains.
    
    1.10 (20-Mar-2022)
        - Added Spanish translations. Thanks to "Toranks" for providing.
        - Changes to fix warnings when compiling on SM 1.11.
    
    1.9 (15-Sep-2021)
        - Now uses the new forward provided by "Save Weapon" plugin modified by "HarryPotter". Requires version "5.4" or newer.
        - For compatibility with both plugins to work together. Thanks to "HarryPotter" for supporting.
        - Supported plugin can be found here: https://github.com/fbef0102/L4D2-Plugins/tree/master/l4d2_ty_saveweapons
    
    1.8 (13-Sep-2021)
        - Added support for "L4D2 coop save weapon" version by "HarryPotter".
        - Removed support for [l4d2] Save Weapon (Co-op)" plugin by "maks".
        - Changes to prevent giving upgraded ammo when someone respawns.
    
    1.7 (12-Sep-2021)
        - Fixed not restoring map transitioned ammo on round restart. Thanks to "swiftswing1" for reporting.
    
    1.6 (11-Sep-2021)
        - Fixed not saving ammo on map transition. Thanks to "swiftswing1" for reporting.
    
    1.5 (30-Aug-2021)
        - Fixed the plugin breaking in modes other than coop. Thanks to "swiftswing1" for reporting and testing.
    
    1.4 (17-Aug-2021)
        - Now automatically detects "[l4d2] Save Weapon (Co-op)" plugin by "maks" to fix giving upgrade ammo to players after map transition.
    
    1.3 (15-Aug-2021)
        - Added cvar "l4d2_switch_ammo_hint" to display a message when taking upgrade ammo about how to use the plugin.
        - Added file "switch_ammo.phrases.txt" to display hints.
        - Fix for "[l4d2] Save Weapon (Co-op)" plugin by "maks". Thanks to "swiftswing1" for reporting.
    
    1.2 (21-Aug-2020)
        - Fixed the last update accidentally enabling unlimited usage of upgrade ammo piles.
    
    1.1 (18-Aug-2020)
        - Blocked the M60 and Grenade Launcher from being able to switch ammo types.
    
    1.0 (16-Jun-2020)
        - Initial release.


    Installation:
    1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.
    2. Download the .txt gamedata file and put into your servers \addons\sourcemod\gamedata\ folder.
    3. Download "translations.zip" and extract the "translations" folder to your servers \addons\sourcemod\ folder.

    Updating from 1.16 or older:
    • New cvars have been added: use the Cvar Configs Updater, or delete the old cvars config or manually add them.

    Updating from 1.17 or older:
    • New translations have been added.

    Current Translations: English (en), Spanish (es), Simplified Chinese (chi), Traditional Chinese (zho).
    Attached Files
    File Type: txt l4d2_switch_ammo.txt (137 Bytes, 620 views)
    File Type: sp Get Plugin or Get Source (l4d2_switch_ammo.sp - 228 views - 47.3 KB)
    File Type: zip translations.zip (2.0 KB, 606 views)
    __________________

    Last edited by Silvers; 11-07-2023 at 02:38.
    Silvers is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 06-16-2020 , 06:29   Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
    Reply With Quote #2

    testing =)
    ~
    tested =D

    test video up =) " https://www.youtube.com/watch?v=SDUXU08P2Gc "
    your welcome to use the video as a demonstration if you want =)

    Last edited by sonic155; 06-16-2020 at 07:37. Reason: update / adding youtube video
    sonic155 is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 06-16-2020 , 11:23   Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
    Reply With Quote #3

    Thanks for the video. Did you notice any issues? Haven't watched it all yet.

    Looks like M60 and probably Grenade Launcher still have bugs using it. I might have to block them entirely because I'm sick of spending hours trying to fix these stupid ammo bugs. Lucky I even managed to finish the plugin as is. Come to think of it... that issue might be present with all weapons when they have no more reserve ammo and only down to the last clip. Oof. FML.
    __________________

    Last edited by Silvers; 06-16-2020 at 11:23.
    Silvers is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 06-16-2020 , 11:40   Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
    Reply With Quote #4

    Quote:
    Originally Posted by Silvers View Post
    Thanks for the video. Did you notice any issues? Haven't watched it all yet.

    Looks like M60 and probably Grenade Launcher still have bugs using it. I might have to block them entirely because I'm sick of spending hours trying to fix these stupid ammo bugs. Lucky I even managed to finish the plugin as is. Come to think of it... that issue might be present with all weapons when they have no more reserve ammo and only down to the last clip. Oof. FML.
    ~~~~
    as i saw no bugs nothing wrong i didnt go into other maps or restart though the m60 was fine and the GL had both 1 fire and 1 explove but other then that nothing on my side =o
    sonic155 is offline
    Black_Wolf
    Junior Member
    Join Date: Dec 2019
    Location: Italy
    Old 06-19-2020 , 13:35   Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
    Reply With Quote #5

    Tested for a whole map the plugin using a grenade launcher with special ammo multiple times. No issues at all, works perfectly even after a chapter load. Great plugin Silvers! This goes into my favorites!

    Last edited by Black_Wolf; 06-19-2020 at 13:36.
    Black_Wolf is offline
    PEK727
    Junior Member
    Join Date: Aug 2020
    Location: United States
    Old 08-16-2020 , 22:39  
    Reply With Quote #6

    I found some bugs in switching ammo types:

    M60 and Grenade Launcher can't carry any more bullets besides their active ammo so all you can do is change its type but not have additional ammo. If you pick up upgrade ammo when your gun is empty and switch off the upgrade ammo it turns the special ammo into regular ammo and makes the reserve ammo count read much higher than it should even though it's still 0; if you shoot and switch back this also causes the special ammo counter to read the number of bullets remaining to be incorrect. You can't switch to any upgrade clips you picked up with a gun when it's default ammo is empty, has to be refilled first.

    Not sure what can even be fixed but I figured I'd report anyway.
    PEK727 is offline
    Shao
    Senior Member
    Join Date: Jan 2015
    Old 08-17-2020 , 18:42   Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
    Reply With Quote #7

    The plugin conflicts with Multiple Equipment, as in. Switching for ammo will also switch the first slot weapon.

    They can work together, but it's extremely clunky, I would not recommend using both at the same time.
    Shao is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-18-2020 , 14:42   Re: [L4D2] Switch Upgrade Ammo Types (1.1) [18-Aug-2020]
    Reply With Quote #8

    Code:
    1.1 (18-Aug-2020)
        - Blocked the M60 and Grenade Launcher from being able to switch ammo types.
    __________________
    Silvers is offline
    sonic155
    Senior Member
    Join Date: Mar 2019
    Old 08-18-2020 , 20:20   Re: [L4D2] Switch Upgrade Ammo Types (1.1) [18-Aug-2020]
    Reply With Quote #9

    my server has it to be 2clips of upgrade ammo if i pick up explo ammo i get 100clip then i pick up fire ammo get 100clip then next map load i have fire ammo 100clip but when i switch to explo i have 50clip o.o
    sonic155 is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 08-26-2020 , 18:50   Re: [L4D2] Switch Upgrade Ammo Types (1.2) [21-Aug-2020]
    Reply With Quote #10

    Without seeing a video I don't know what you mean. It works as intended and I have no issue on map change even with increased clip sizes.
    __________________
    Silvers is offline
    Reply


    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 14:51.


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