AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Switch Upgrade Ammo Types (1.29) [07-Nov-2023] (https://forums.alliedmods.net/showthread.php?t=325300)

Silvers 06-16-2020 01:19

[L4D2] Switch Upgrade Ammo Types (1.29) [07-Nov-2023]
 
35 Attachment(s)
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).

sonic155 06-16-2020 06:29

Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
 
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 =)

Silvers 06-16-2020 11:23

Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
 
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.

sonic155 06-16-2020 11:40

Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
 
Quote:

Originally Posted by Silvers (Post 2706027)
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

Black_Wolf 06-19-2020 13:35

Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
 
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!

PEK727 08-16-2020 22:39

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.

Shao 08-17-2020 18:42

Re: [L4D2] Switch Upgrade Ammo Types (1.0) [16-Jun-2020]
 
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.

Silvers 08-18-2020 14:42

Re: [L4D2] Switch Upgrade Ammo Types (1.1) [18-Aug-2020]
 
Code:

1.1 (18-Aug-2020)
    - Blocked the M60 and Grenade Launcher from being able to switch ammo types.


sonic155 08-18-2020 20:20

Re: [L4D2] Switch Upgrade Ammo Types (1.1) [18-Aug-2020]
 
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

Silvers 08-26-2020 18:50

Re: [L4D2] Switch Upgrade Ammo Types (1.2) [21-Aug-2020]
 
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.


All times are GMT -4. The time now is 16:42.

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