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.

Spirit_12 09-05-2020 17:51

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

Originally Posted by Silvers (Post 2716803)
the animation glitches once and stops (unlike the other guns which repeatedly glitch for several seconds).

I'm talking about it glitching once, nothing more. Was wondering if it can be fixed, although its not a big issue.

Silvers 09-06-2020 18:25

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

Originally Posted by Spirit_12 (Post 2716822)
I'm talking about it glitching once, nothing more. Was wondering if it can be fixed, although its not a big issue.

Ahh yeah. I think this is client side prediction issue and cannot be fixed at all. At least with shotguns it only happens once unlike other weapons which is why I made this plugin, but other weapons still show that type of client side behaviour with glitching once, although it looks like the players just checking their clip so doesn't exactly break realism imo.

Spicy Hot Pot 09-11-2020 08:25

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1) [05-Sep-2020]
 
Is there any way to make our custom weapon scripts to work in other's server?:bee:

Silvers 09-24-2020 14:15

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Code:

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


Shao 09-29-2020 14:25

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Nice work Silvers, it's nice to have an alternative for those who don't want to deal with the download of VPK scripts. Making it less spastic is hands down better than having other bugs that deteriorates the player experience, especially those that tend to judge modded servers harshly.

JLmelenchon 02-06-2021 09:02

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Sadly this plugin does not fix anything, players is still trying to reload the weapon when magzine is full and if you spam enough reload button eventually the animation totally break.

I have last version of dhooks and left4dhooks.

edit: not exactly true, it mostly break when you are close from an ammo pile and reload a full clip.

Silvers 03-21-2021 10:29

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Quote:

Originally Posted by JLmelenchon (Post 2735927)
Sadly this plugin does not fix anything, players is still trying to reload the weapon when magzine is full and if you spam enough reload button eventually the animation totally break.

I have last version of dhooks and left4dhooks.

edit: not exactly true, it mostly break when you are close from an ammo pile and reload a full clip.

Interesting thanks will try sometime. Doubt anything can be done to fix it though.



Quote:

Originally Posted by aiyoaiui (Post 2741142)
L 03/21/2021 - 122:56: SourceMod error session started
L 03/21/2021 - 122:56: Info (map "c7m1_docks") (file "G:\online games\steam\steamapps\common\Left 4 Dead 2\left4dead2\addons\sourcemod\logs\errors_202 10321.log")
L 03/21/2021 - 122:56: [SM] Exception reported: Failed to find signature: CTerrorGun::Reload
L 03/21/2021 - 122:56: [SM] Blaming: l4d_reload_fix.smx
L 03/21/2021 - 122:56: [SM] Call stack trace:
L 03/21/2021 - 122:56: [SM] [0] SetFailState
L 03/21/2021 - 122:56: [SM] [1] Line 171, l4d_reload_fix.sp::OnPluginStart
L 03/21/2021 - 122:56: [SM] Unable to load plugin "l4d_reload_fix.smx": Error detected in plugin startup (see error logs)
L 03/21/2021 - 12:47:51: Error log file session closed.

You must have some plugin detouring the same function, remove half and restore half until you find which plugin is causing the conflict. Nothing wrong with this plugin otherwise.

pan0s 04-20-2021 16:52

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
I am glad if you could tell me what Ammo and clips size control plugin you are using.

Silvers 04-21-2021 05:24

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Mission and Weapons - Info Editor plugin can modify clip sizes. This is what I use.

Psyk0tik 06-17-2021 15:02

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Hey Silvers,

Here's the new signature for "CBaseShotgun::Reload" which only changed by 1 byte:
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\xB4\x1C\x00\x00"
    
/* ? ? ? ? ? ? 56 57 8B F1 E8 ? ? ? ? 8B F8 85 FF 0F 84 ? ? ? ? 8B 87 B4 1C 00 00 */
    /* Signature provided by Lux & Crasher_3637 */


The offsets are still the same as well as the signature for the "CTerrorGun::Reload" function.

Silvers 06-17-2021 15:11

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.1a) [24-Sep-2020]
 
Hmm interesting, hadn't noticed it broke since the signature was still valid. Thanks

Edit: updated.

Silvers 06-29-2021 11:26

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.2) [29-Jun-2021]
 
Code:

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

Only noticed this when I decided to change all ammo amounts on my server.

Alexmy 07-04-2021 20:20

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.2) [29-Jun-2021]
 
Hi, silvers, with an enlarged ammo clip, I have problems with animation. Could you add more weapon_smg_mp5 ?

Silvers 07-05-2021 02:03

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3) [05-Jul-2021]
 
Quote:

Originally Posted by Alexmy (Post 2751890)
Hi, silvers, with an enlarged ammo clip, I have problems with animation. Could you add more weapon_smg_mp5 ?

Thanks, I think that's the last missing one.

Code:

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


vikingo12 09-06-2021 17:13

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3) [05-Jul-2021]
 
L 09/06/2021 - 21:20:57: [SM] Exception reported: Failed to find signature: CTerrorGun::Reload
L 09/06/2021 - 21:20:57: [SM] Blaming: optional\l4d_reload_fix.smx
L 09/06/2021 - 21:20:57: [SM] Call stack trace:
L 09/06/2021 - 21:20:57: [SM] [0] SetFailState
L 09/06/2021 - 21:20:57: [SM] [1] Line 185, C:\Servers\L4D2\left4dead2\addons\sourcemod\s cripting\l4d_reload_fix.sp::OnPluginStart

Silvers 09-06-2021 17:38

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3) [05-Jul-2021]
 
Replace the "CTerrorGun::Reload" signature with this one and report back if it works.

Code:

                        "CTerrorGun::Reload"
                        {
                                "library"                "server"
                                "linux"                        "@_ZN10CTerrorGun6ReloadEv"
                                "windows"                "\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83"
                                /* ? ? ? ? ? ? 53 56 8B ? E8 ? ? ? ? 8B ? 85 ? 0F 84 ? ? ? ? 8B ? ? ? ? ? 83 */
                                /* VTable method. Using "!player->CanAttack()" 1 call below. */
                        }


vikingo12 09-07-2021 07:31

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3) [05-Jul-2021]
 
Quote:

Originally Posted by Silvers (Post 2757110)
Replace the "CTerrorGun::Reload" signature with this one and report back if it works.

Code:

                        "CTerrorGun::Reload"
                        {
                                "library"                "server"
                                "linux"                        "@_ZN10CTerrorGun6ReloadEv"
                                "windows"                "\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83"
                                /* ? ? ? ? ? ? 53 56 8B ? E8 ? ? ? ? 8B ? 85 ? 0F 84 ? ? ? ? 8B ? ? ? ? ? 83 */
                                /* VTable method. Using "!player->CanAttack()" 1 call below. */
                        }


seems to work, no errors in logs

NoroHime 12-08-2021 22:35

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
[] sm plugins load l4d_reload_fix
[SM] Plugin l4d_reload_fix.smx failed to load: Native "L4D2_GetIntWeaponAttribute" was not found.
im sure my gamedata not error print
update:
lol my wrong, now installed dhooks direct

ChooMcoo 09-07-2023 17:12

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
I have personally edited various weapon script files and inserted them into my server via VPK, and this plugin does not fix their reloads. The server loads the plugin when I check the list, so I was wondering if maybe the plugin needs to be updated to catch up with the current status of DHooks in SourceMod 1.11? As I see you say DHooks (Experimental Dynamic Detour support) extension is a requirement even though it was merged into SourceMod last year. Any help would be appreciated.

Spirit_12 09-07-2023 17:20

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
Now you are incorporating vscripts to modify weapons, which would highly depend on the implementation of the weapons. This plugin hooks the in game function which may not be called from vscript.

ChooMcoo 09-07-2023 17:43

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
Is there a better way to modify the weapons?

Spirit_12 09-08-2023 19:08

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
Read the plugin description. Silver has mentioned alternatives there.

ChooMcoo 09-09-2023 17:48

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
I have no clue what either of those alternatives entail and how I would go about using them. Where might I find more info? I didn't really see anything to go off of on the DHooks page.

Spirit_12 09-09-2023 22:01

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.3a) [08-Sep-2021]
 
https://forums.alliedmods.net/showthread.php?t=321696
https://forums.alliedmods.net/showthread.php?t=310586

chungocanh12 04-17-2024 03:58

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.4) [07-Nov-2023]
 
hi Silver, can you add support m60 and grenade launcher. when i changer clip size m60 (default: 150 to 125), grenade launcher(default: 1 to 2) with plugin: https://forums.alliedmods.net/showthread.php?t=310586, my gun glitch with reload always when i press reload button while the bullets were full in clip size. Can you check that, thanks you!!!

Silvers 04-17-2024 11:34

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.4) [07-Nov-2023]
 
Quote:

Originally Posted by chungocanh12 (Post 2821057)
hi Silver, can you add support m60 and grenade launcher. when i changer clip size m60 (default: 150 to 125), grenade launcher(default: 1 to 2) with plugin: https://forums.alliedmods.net/showthread.php?t=310586, my gun glitch with reload always when i press reload button while the bullets were full in clip size. Can you check that, thanks you!!!

I see no issue with the M60, which plugin are you using to allow reloading the weapon / picking up ammo etc?

Grenade Launcher is behaving strangely, sometimes the fix works, sometimes it doesn't. The only thing to really stop it would be to remove the weapon and equip it again, it will show the weapon equip animation and if you hold R will spam the equip sound. Nothing else seems to work.

chungocanh12 04-18-2024 04:09

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.4) [07-Nov-2023]
 
Quote:

Originally Posted by Silvers (Post 2821082)
I see no issue with the M60, which plugin are you using to allow reloading the weapon / picking up ammo etc?

Grenade Launcher is behaving strangely, sometimes the fix works, sometimes it doesn't. The only thing to really stop it would be to remove the weapon and equip it again, it will show the weapon equip animation and if you hold R will spam the equip sound. Nothing else seems to work.

Thank for rep, yes i’m using m60 and grenade launcher patche to pick ammo and reloading the weapon. My issue: reloading after reloaded gun. I can press R to reload any time after i’m completed action reload

I’m using it: https://forums.alliedmods.net/showthread.php?p=2694504

Silvers 04-21-2024 10:50

Re: [L4D & L4D2] Reload Fix - Max Clip Size (1.5) [21-Apr-2024]
 
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.



All times are GMT -4. The time now is 11:10.

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