AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Reload Fix - Max Clip Size (1.5) [21-Apr-2024] (https://forums.alliedmods.net/showthread.php?t=327105)

Silvers 09-01-2020 14:00

[L4D & L4D2] Reload Fix - Max Clip Size (1.5) [21-Apr-2024]
 
25 Attachment(s)
Fixes:
  • Reload animation glitching when a modified clip size is full.
  • Shotgun animation stopping after reloading 15 bullets.

When using Left4DHooks L4D2_SetIntWeaponAttribute(classname, L4D2IWA_ClipSize, XX);
- OR -
Info Editor to modify "clip_size" key value.
- OR -
some other method to modify the clip size e.g. directly modifying weapon.txt script files (L4D1).


For some reason detouring "CTerrorGun::Reload" using the VTable method kept crashing, so I've gone with using signatures.


Related Plugins:


Cvars:

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

PHP Code:

l4d_reload_fix_m60 "0" // 0=Off, 1=Fix the M60 from reload bug issues. 



Changes:
Code:

1.5 (21-Apr-2024)
    - Added cvar "l4d_reload_fix_m60" to control if the M60 should be fixed or not, since I encounter no bug with changed clip size.
    - Fixed the Grenade Launcher and M60 playing the reload animation when a modified clip size is full. Thanks to "chungocanh12" for reporting.

1.4 (07-Nov-2023)
    - Fixed not deleting 2 handles. Thanks to "HarryPotter" for reporting.

1.3a (08-Sep-2021)
    - GameData file updated. Wildcarded "CTerrorGun::Reload" to support other plugins detouring this function.
    - Thanks to "vikingo12" for reporting.

1.3 (05-Jul-2021)
    - L4D2: Added support for the "weapon_smg_mp5" weapon. Thanks to "Alexmy" for reporting.

1.2 (29-Jun-2021)
    - L4D2: Added support for the Magnum "weapon_pistol_magnum" pistol.

1.1b (17-Jun-2021)
    - Compatibility update for L4D2's "2.2.1.3" game update. Thanks to "Crasher_3637" for fixing.
    - GameData .txt file updated.

1.1a (24-Sep-2020)
    - Compatibility update for L4D2's "The Last Stand" update.
    - GameData .txt file updated.

1.1 (05-Sep-2020)
    - Now prevents changing anything when the max clip size is unchanged.
    - Added a fix for shotgun reload animation stopping when reloading >= 15 bullets at one time.
    - Thanks to "fbef0102" for reporting.
    - GameData file updated.

1.0 (25-Aug-2020)
    - Initial release.



Requirements:
  1. SourceMod 1.11 or newer
  2. -OR-
  3. DHooks (Experimental Dynamic Detour support) and manually compiling the plugin
  4. L4D2 only: Left 4 DHooks Direct plugin.


Installation:
DO NOT click 'Get Plugin' or it will fail to compile because this plugin requires DHooks!
  1. Download the .smx file and put into your servers \addons\sourcemod\plugins folder.
  2. Download "l4d_reload_fix.txt" and put the file into your servers \addons\sourcemod\gamedata\ folder.

Updating from 1.0:
  • GameData .txt file must be updated.

HarryPotter 09-02-2020 12:08

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Sorry, will you also fix autoshotgun(including spas) reloading animation glitch?

This glitch only happens when
you start to reload shotgun from 0 to 15 or above.
One day, I used Info Editor to modify autoshotgun "clip_size" key value to 20, and I just found this glitch.
This animation glitch doesn't affect anything, just a question here

ReCreator 09-02-2020 15:13

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Also, if player has full "edited" clip and try to reload, animation start an break in a second.

Spirit_12 09-02-2020 18:52

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
This will work nicely on my server.

A few observations. While this does fix the constant animation glitch there is still some room for improvement. I have reduced ammo for the shotguns on my server, so clip size is 8 and 9 for Spaz and autoshotgun. The animation glitch still happens when you try to reload on full clip. Again its just visual, but it does happen. I'll provide more feedback as I do more testing.

Alex101192 09-04-2020 13:37

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Are there any issues that could come up when using this plugin while there was no modification to the clip size?

Silvers 09-04-2020 14:32

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Quote:

Originally Posted by fbef0102 (Post 2716408)
Sorry, will you also fix autoshotgun(including spas) reloading animation glitch?

This glitch only happens when
you start to reload shotgun from 0 to 15 or above.
One day, I used Info Editor to modify autoshotgun "clip_size" key value to 20, and I just found this glitch.
This animation glitch doesn't affect anything, just a question here

Have fixed reload animation stopping on shotguns when reloading >= 15 in one go. Sent PM test version before releasing.


Quote:

Originally Posted by ReCreator (Post 2716438)
Also, if player has full "edited" clip and try to reload, animation start an break in a second.

That's the best the plugin can do due to client side prediction, without this fix the animation would constantly spaz out trying to start for a few seconds.


Quote:

Originally Posted by Spirit_12 (Post 2716456)
This will work nicely on my server.

A few observations. While this does fix the constant animation glitch there is still some room for improvement. I have reduced ammo for the shotguns on my server, so clip size is 8 and 9 for Spaz and autoshotgun. The animation glitch still happens when you try to reload on full clip. Again its just visual, but it does happen. I'll provide more feedback as I do more testing.

Shotguns don't trigger the function being detoured, but also don't spaz out constantly trying to reload for several seconds like other weapons.


Quote:

Originally Posted by Alex101192 (Post 2716640)
Are there any issues that could come up when using this plugin while there was no modification to the clip size?

No it shouldn't affect anything, but in the next version will ignore doing anything when the clips stock size.

Spirit_12 09-04-2020 20:02

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Quote:

Originally Posted by Silvers (Post 2716652)
Shotguns don't trigger the function being detoured, but also don't spaz out constantly trying to reload for several seconds like other weapons.

I looked it up and apparently Ladder Rambos had the same issue. Maybe add it for shotguns as well? I'll see if I can provide windows signature.

PHP Code:

"CBaseShotgun::Reload"
{
    
"library"    "server"
    "linux"    "@_ZN12CBaseShotgun6ReloadEv"
    "windows"    ""



Lux 09-04-2020 20:40

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
Should be the windows sig, already had some shotgun functions reversed for windows, i'v never tested to be 100% sure.
PHP Code:

"CBaseShotgun::Reload"
{
    
"library"    "server"
    "linux"    "@_ZN12CBaseShotgun6ReloadEv"
    "windows"    "\x2A\x2A\x2A\x2A\x2A\x2A\x56\x57\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x8B\xF8\x85\xFF\x0F\x84\x2A\x2A\x2A\x2A\x8B\x87\xD4\x1C\x00\x00"
    
/* ? ? ? ? ? ? 56 57 8B F1 E8 ? ? ? ? 8B F8 85 FF 0F 84 ? ? ? ? 8B 87 D4 1C 00 00 */



Spirit_12 09-04-2020 21:35

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.0) [01-Sep-2020]
 
2 Attachment(s)
I actually went ahead and tried the shotgun thing and it doesn't seem to work. I'll leave the source here if anyone want to tinker with it.

Silvers 09-05-2020 15:02

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1) [05-Sep-2020]
 
Updated:

Code:

1.1 (05-Sep-2020)
    - Now prevents changing anything when the max clip size is unchanged.
    - Added a fix for shotgun reload animation stopping when reloading >= 15 bullets at one time.
    - Thanks to "fbef0102" for reporting.
    - GameData file updated.


I don't see an issue with shotguns when a modified clip size is full, the animation glitches once and stops (unlike the other guns which repeatedly glitch for several seconds). The same would happen if the fix was applied to the shotgun so it's not necessary. If this is wrong show me a video of the issue.


All times are GMT -4. The time now is 20:34.

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