AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] No Reload Animation Fix (1.8) [03-Apr-2024] (https://forums.alliedmods.net/showthread.php?t=333100)

Silvers 06-19-2021 09:04

[L4D2] No Reload Animation Fix (1.8) [03-Apr-2024]
 
11 Attachment(s)
About:
  • Fixes picking up a weapon of the same type and refilling the clip size to full.
  • Returns the clip size to the previous value and adds the new ammo to the reserve.


Thanks:
  • Eärendil - For the idea and request



Related Plugins:



ConVars:

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

PHP Code:

// When using the give command and replacing the same weapon type, transfer ammo to the new weapon. 0=No. 1=Yes.
l4d2_reload_fix_give "0"

// No Reload Animation Fix plugin version
l4d2_reload_fix_version 



Changes:
Code:

1.8 (03-Apr-2024)
    - Fixed wrong weapons ammo when switch weapons. Thanks to "HarryPotter" for the update.

1.7 (12-Mar-2024)
    - Save all clients weapons ammo, useful if weapon ammo exceeded the official ammo cvar. Thanks to "HarryPotter" for the update.

1.6 (25-May-2023)
    - Added cvar "l4d2_reload_fix_give" to optionally prevent "give" command with same type of weapon setting to the previous weapons ammo.

1.5 (20-Aug-2022)
    - Records all weapons clip and ammo. Thanks to "HarryPotter" for writing.

1.4 (29-Mar-2022)
    - Fixed not always detecting the correct current weapon. Thanks to "Forgetest" for fixing.

1.3 (02-Nov-2021)
    - Fixed treating different weapon skins as the same weapon. Thanks to "tRololo312312" for reporting.

1.2 (06-Jul-2021)
    - Fixed throwing errors about invalid entity. Thanks to "HarryPotter" for reporting.

1.1 (27-Jun-2021)
    - Fixed throwing errors about invalid entity. Thanks to "HarryPotter" for reporting.

1.0 (19-Jun-2021)
    - Initial release.



Installation:
  1. Click "Get Plugin" and put the .smx file into your servers \addons\sourcemod\plugins\ folder.

vikingo12 06-24-2021 09:40

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
Love the plugin:)
But on holdout events, the trick still can be done just by picking another gun

Silvers 06-24-2021 12:05

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
Quote:

Originally Posted by vikingo12 (Post 2750978)
Love the plugin:)
But on holdout events, the trick still can be done just by picking another gun

Can you please explain more in detail how to do this? When picking up a weapon of the same type from a weapon spawner that's what the plugin fixes resetting the clip size. So it acts like they're simply picking up ammo from an ammo pile.

moschinovac 06-24-2021 12:56

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
He mean if theres 2 different guns on ground and one gun is same as the gun u r holding. U still can do the trick by pick up different gun then pick up the other gun same as the gun u used. I guess...

Silvers 06-24-2021 13:08

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
But they are 2 different weapons and will have 2 different clips, which is expected to not have to reload. Or you mean 2 different spawner weapon types pick up one, it swallows the old, then pickup the other which is the same as the last you just had? Well that gets more complicated with timing, how long should you be allowed before you can take a weapon of the same type you just had X seconds ago etc etc. I guess you would store the classname of every weapon for every client and the time they last held that weapon, then prevent or reset to old ammo value. It's not something I'm really interested in doing, sounds tedious and boring to write. I might do but this is not on the priority list.

Shao 06-24-2021 17:32

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
Quote:

Originally Posted by vikingo12 (Post 2750978)
Love the plugin:)
But on holdout events, the trick still can be done just by picking another gun

If that happens to be a problem, using single weapon spawns will fix that issue.

What the plugin achieve here is rather niche but an extremely sweet detail to add up on.

HarryPotter 06-27-2021 05:58

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
PHP Code:

L 06/27/2021 17:42:20: [SMException reportedEntity -(-1is invalid
L 06
/27/2021 17:42:20: [SMBlamingl4d2_reload_fix.smx
L 06
/27/2021 17:42:20: [SMCall stack trace:
L 06/27/2021 17:42:20: [SM]   [0GetEntProp
L 06
/27/2021 17:42:20: [SM]   [1Line 159l4d2_reload_fix.sp::OnFrame 


Silvers 06-27-2021 08:34

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.0) [19-Jun-2021]
 
Quote:

Originally Posted by HarryPotter (Post 2751301)
PHP Code:

L 06/27/2021 17:42:20: [SMException reportedEntity -(-1is invalid
L 06
/27/2021 17:42:20: [SMBlamingl4d2_reload_fix.smx
L 06
/27/2021 17:42:20: [SMCall stack trace:
L 06/27/2021 17:42:20: [SM]   [0GetEntProp
L 06
/27/2021 17:42:20: [SM]   [1Line 159l4d2_reload_fix.sp::OnFrame 


Thanks, I knew I should have added a check. Someone can lose their weapon in 1 frame!

Code:

1.1 (27-Jun-2021)
    - Fixed throwing errors about invalid entity. Thanks to "HarryPotter" for reporting.


HarryPotter 07-02-2021 15:46

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.1) [27-Jun-2021]
 
PHP Code:

L 07/02/2021 23:36:24: [SMException reportedInvalid edict (-- -1)
L 07/02/2021 23:36:24: [SMBlamingl4d2_reload_fix.smx
L 07
/02/2021 23:36:24: [SMCall stack trace:
L 07/02/2021 23:36:24: [SM]   [0GetEdictClassname
L 07
/02/2021 23:36:24: [SM]   [1Line 140l4d2_reload_fix.sp::WeaponCanUse 


Silvers 07-06-2021 09:38

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by HarryPotter (Post 2751738)
PHP Code:

L 07/02/2021 23:36:24: [SMException reportedInvalid edict (-- -1)
L 07/02/2021 23:36:24: [SMBlamingl4d2_reload_fix.smx
L 07
/02/2021 23:36:24: [SMCall stack trace:
L 07/02/2021 23:36:24: [SM]   [0GetEdictClassname
L 07
/02/2021 23:36:24: [SM]   [1Line 140l4d2_reload_fix.sp::WeaponCanUse 


Code:

1.2 (06-Jul-2021)
    - Fixed throwing errors about invalid entity. Thanks to "HarryPotter" for reporting.

Thanks, fixed.

vikingo12 08-25-2021 18:16

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
if ammo isnt full, (for example smg 600/0) you can switch any other slot to skip it and have your clip full

Silvers 08-26-2021 07:36

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by vikingo12 (Post 2756182)
if ammo isnt full, (for example smg 600/0) you can switch any other slot to skip it and have your clip full

Can you show a video? Maybe you have some other plugin conflicting. When I try doing this the clip size is 0 and switching does not reload but remains on 0 ammo. Or maybe I didn't understand the steps on how to replicate the issue.

vikingo12 08-28-2021 12:34

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by Silvers (Post 2756225)
Can you show a video? Maybe you have some other plugin conflicting. When I try doing this the clip size is 0 and switching does not reload but remains on 0 ammo. Or maybe I didn't understand the steps on how to replicate the issue.

https://www.youtube.com/watch?v=cAJwDgRW70I

Silvers 08-28-2021 19:38

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Cannot replicate this issue. Maybe another plugin is causing this. Try removing all except reload fix and testing. If that works then add half/remove half the plugins until you find the one causing it.

vikingo12 09-02-2021 02:50

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by Silvers (Post 2756421)
Cannot replicate this issue. Maybe another plugin is causing this. Try removing all except reload fix and testing. If that works then add half/remove half the plugins until you find the one causing it.

Started a fresh server with this plugin only, still was able to do that

Silvers 09-02-2021 08:50

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by vikingo12 (Post 2756741)
Started a fresh server with this plugin only, still was able to do that

Can anyone else confirm this happening? When I reload and switch weapon, then switch back it stays at 0 ammo. Maybe some mod your client/server is using causing this? Because I can't replicate the issue it's difficult to test any potential fix.

I've sent you a PM with a new version if you could test please. Thanks.

tRololo312312 11-02-2021 02:37

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Add exclusion for guns that are same but with different skin because those get dropped to the ground.

Silvers 11-02-2021 04:54

Re: [L4D2] No Reload Animation Fix (1.3) [02-Nov-2021]
 
Done.

Code:

1.3 (02-Nov-2021)
    - Fixed including the different weapon skins as the same weapon. Thanks to "tRololo312312" for reporting.


tRololo312312 11-04-2021 02:12

Re: [L4D2] No Reload Animation Fix (1.3) [02-Nov-2021]
 
Many thanks.

Forgetest 03-29-2022 09:01

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by vikingo12 (Post 2756377)

PHP Code:

        int current GetPlayerWeaponSlot(client0);//GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); 

Maybe this can fix the issue, as long as only primary weapons to work on.

vikingo12 03-29-2022 09:04

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by Forgetest (Post 2775476)
PHP Code:

        int current GetPlayerWeaponSlot(client0);//GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon"); 

Maybe this can fix the issue, as long as only primary weapons to work on.

FIXED!

HarryPotter 03-29-2022 12:02

Re: [L4D2] No Reload Animation Fix - Picking Up Same Weapon (1.2) [06-Jul-2021]
 
Quote:

Originally Posted by Silvers (Post 2756773)
Can anyone else confirm this happening? When I reload and switch weapon, then switch back it stays at 0 ammo. Maybe some mod your client/server is using causing this? Because I can't replicate the issue it's difficult to test any potential fix.

I've sent you a PM with a new version if you could test please. Thanks.

I can confirm this bug.
Change the current weapon to pistol or other slot, and then take same smg on the ground => full clip
Code modified by Forgetest can fix this.

PHP Code:

int current GetPlayerWeaponSlot(client0); 


Quote:

Originally Posted by Silvers (Post 2751008)
But they are 2 different weapons and will have 2 different clips, which is expected to not have to reload. Or you mean 2 different spawner weapon types pick up one, it swallows the old, then pickup the other which is the same as the last you just had? Well that gets more complicated with timing, how long should you be allowed before you can take a weapon of the same type you just had X seconds ago etc etc. I guess you would store the classname of every weapon for every client and the time they last held that weapon, then prevent or reset to old ammo value. It's not something I'm really interested in doing, sounds tedious and boring to write. I might do but this is not on the priority list.

I try to save all weapons and clips for each client in l4d1 cuz there only 5 weapons.
Well, it works prefect for me.
My code is provided, you can have a look.

Silvers 03-29-2022 12:30

Re: [L4D2] No Reload Animation Fix (1.4) [29-Mar-2022]
 
Quote:

Originally Posted by HarryPotter (Post 2775492)
I try to save all weapons and clips for each client in l4d1 cuz there only 5 weapons.

This bug affects L4D1 also? I never noticed it and couldn't replicate.



Code:

1.4 (29-Mar-2022)
    - Fixed not always detecting the correct current weapon. Thanks to "Forgetest" for fixing.


JLmelenchon 08-17-2022 12:45

Re: [L4D2] No Reload Animation Fix (1.4) [29-Mar-2022]
 
There is a bug, sometimes you will still be able to skip the reload animation despite taking the same weapon.

HarryPotter 08-17-2022 21:11

Re: [L4D2] No Reload Animation Fix (1.4) [29-Mar-2022]
 
Quote:

Originally Posted by JLmelenchon (Post 2786688)
There is a bug, sometimes you will still be able to skip the reload animation despite taking the same weapon.

Probably pick up different skin weapon?

JLmelenchon 08-18-2022 00:28

Re: [L4D2] No Reload Animation Fix (1.4) [29-Mar-2022]
 
Quote:

Originally Posted by HarryPotter (Post 2786735)
Probably pick up different skin weapon?

No the same but it does not happen consistently.

Also if you have a uzi empty then switch to shotgun and reswitch to uzi you skip the reload, it's a little faster than reloading.

HarryPotter 08-18-2022 01:33

Re: [L4D2] No Reload Animation Fix (1.4) [29-Mar-2022]
 
Quote:

Originally Posted by JLmelenchon (Post 2786745)
Also if you have a uzi empty then switch to shotgun and reswitch to uzi you skip the reload, it's a little faster than reloading.

I make some changes to prevent that, you can try mine.

Edit: Thanks, added plugin update to first post! -Silvers

Silvers 05-25-2023 03:47

Re: [L4D2] No Reload Animation Fix (1.6) [25-May-2023]
 
Code:

1.6 (25-May-2023)
    - Added cvar "l4d2_reload_fix_give" to optionally prevent "give" command with same type of weapon setting to the previous weapons ammo.


Silvers 03-12-2024 05:59

Re: [L4D2] No Reload Animation Fix (1.7) [12-Mar-2024]
 
Code:

1.7 (12-Mar-2024)
    - Save all clients weapons ammo, useful if weapon ammo exceeded the official ammo cvar. Thanks to "HarryPotter" for the update.


chungocanh12 04-30-2024 16:03

Re: [L4D2] No Reload Animation Fix (1.8) [03-Apr-2024]
 
I have bug with ammo gun. I’m using ak47 and pick another ak47 it swap to and refill max ammo, but if i’m shoting current ak47 ( 40/500 to 40/450) and pick other ak47 in ground my gun swap that and have max ammo to 40/500. I’m drop current gun and pick my old ak47 and i have bug my ak ammo is 40/500 same witch new ak47. I’m testing shot and drop two gun but 2 gun alway have same ammo reserve


All times are GMT -4. The time now is 22:09.

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