Raised This Month: $2 Target: $400
 0% 

[L4D2] Improved Prevent M60 Drop


Post New Thread Reply   
 
Thread Tools Display Modes
ur5efj
Member
Join Date: Jan 2006
Old 03-29-2020 , 03:54   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #71

SM 1.10.0.6478
Code:
L 03/28/2020 - 23:41:37: SourceMod error session started
L 03/28/2020 - 23:41:37: Info (map "c4m1_milltown_a") (file "C:\SteamCMD\SteamApps\common\Left 4 Dead 2 Dedicated Server\left4dead2\addons\sourcemod\logs\errors_20200328.log")
L 03/28/2020 - 23:41:37: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:37: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:37: [SM] Call stack trace:
L 03/28/2020 - 23:41:37: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:37: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:41:43: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:43: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:43: [SM] Call stack trace:
L 03/28/2020 - 23:41:43: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:43: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:41:44: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:44: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:44: [SM] Call stack trace:
L 03/28/2020 - 23:41:44: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:44: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:42:09: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:42:09: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:42:09: [SM] Call stack trace:
L 03/28/2020 - 23:42:09: [SM]   [0] GetEntProp
L 03/28/2020 - 23:42:09: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:42:13: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:42:13: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:42:13: [SM] Call stack trace:
L 03/28/2020 - 23:42:13: [SM]   [0] GetEntProp
L 03/28/2020 - 23:42:13: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:47:11: Error log file session closed.
ur5efj is offline
MasterMind420
Veteran Member
Join Date: Nov 2010
Old 03-30-2020 , 12:36   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #72

Quote:
Originally Posted by ur5efj View Post
SM 1.10.0.6478
Code:
L 03/28/2020 - 23:41:37: SourceMod error session started
L 03/28/2020 - 23:41:37: Info (map "c4m1_milltown_a") (file "C:\SteamCMD\SteamApps\common\Left 4 Dead 2 Dedicated Server\left4dead2\addons\sourcemod\logs\errors_20200328.log")
L 03/28/2020 - 23:41:37: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:37: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:37: [SM] Call stack trace:
L 03/28/2020 - 23:41:37: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:37: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:41:43: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:43: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:43: [SM] Call stack trace:
L 03/28/2020 - 23:41:43: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:43: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:41:44: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:41:44: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:41:44: [SM] Call stack trace:
L 03/28/2020 - 23:41:44: [SM]   [0] GetEntProp
L 03/28/2020 - 23:41:44: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:42:09: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:42:09: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:42:09: [SM] Call stack trace:
L 03/28/2020 - 23:42:09: [SM]   [0] GetEntProp
L 03/28/2020 - 23:42:09: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:42:13: [SM] Exception reported: Element -1 is out of bounds (Prop m_iAmmo has 32 elements).
L 03/28/2020 - 23:42:13: [SM] Blaming: l4d2_improved_prevent_m60_drop.smx
L 03/28/2020 - 23:42:13: [SM] Call stack trace:
L 03/28/2020 - 23:42:13: [SM]   [0] GetEntProp
L 03/28/2020 - 23:42:13: [SM]   [1] Line 102, l4d2_improved_prevent_m60_drop.sp::eWeaponFire
L 03/28/2020 - 23:47:11: Error log file session closed.
Is that the entirety of your errors log file...something tells me this is being caused by another faulty plugin only because i've never seen this error before except when another plugin is broken. That code within the plugin hasn't changed in years so...unless others can confirm this same error is happening with newer versions of sourcemod there is nothing I can do.
MasterMind420 is offline
ur5efj
Member
Join Date: Jan 2006
Old 03-31-2020 , 07:47   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #73

Thanks!
ur5efj is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Brexit
Old 03-31-2020 , 14:21   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #74

Simple memory patch to Allow M60 and Grenade Launcher to function as any other weapon. Not dropping on empty and picking up ammo to refill

Thanks silvers & mastermind for testing.

Should avoid alot of conflicts.


Update m60 plugin
Consider empty m60 dropping should function as normal can't say for other plugins that fuck with it.

Now lives here
__________________

Last edited by Lux; 04-19-2020 at 02:59. Reason: update
Lux is offline
xZk
Senior Member
Join Date: Nov 2017
Location: cl
Old 04-01-2020 , 11:51   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #75

Quote:
Originally Posted by Lux View Post
Simple memory patch to Allow M60 and Grenade Launcher to function as any other weapon. Not dropping on empty and picking up ammo to refill

Thanks silvers & mastermind for testing.

Should avoid alot of conflicts.
Works excellent!, but the problem still persists when the M60 is dropped with clip = 0, it cannot be picked up again
xZk is offline
MasterMind420
Veteran Member
Join Date: Nov 2010
Old 04-01-2020 , 13:04   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #76

Quote:
Originally Posted by xZk View Post
Works excellent!, but the problem still persists when the M60 is dropped with clip = 0, it cannot be picked up again
I'm going to do some testing but i already have a simple fix for that. When dropping add 1 to clip...hook use on the M60...Set Clip back to 0 when picked up...works fine...if the weapon completely runs out of ammo both clip and reserve i believe they cannot be picked up at all...any weapon. I'll add that to the m60 plugin on the first post and add the mempatch to the front page as well.
MasterMind420 is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Brexit
Old 04-02-2020 , 00:58   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #77

could not find where to patch for m60 picking up while empty so added an alternative solution #74
__________________
Lux is offline
MasterMind420
Veteran Member
Join Date: Nov 2010
Old 04-02-2020 , 02:27   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #78

This will fix other drop plugins if put into them...

Code:
void WeaponDrop(int client, int weapon)
{
	SDKHooks_DropWeapon(client, weapon, NULL_VECTOR, NULL_VECTOR);

	char sClsName[32];
	GetEntityClassname(weapon, sClsName, sizeof(sClsName));

	if (strncmp(sClsName[7], "defibrillator", 13) == 0)
		SetEntProp(weapon, Prop_Send, "m_iWorldModelIndex", GetEntProp(weapon, Prop_Data, "m_nModelIndex"));
	else if (strncmp(sClsName[7], "rifle_m60", 9) == 0)
	{
		SDKHook(weapon, SDKHook_Use, OnPlayerUse);

		if (GetEntProp(weapon, Prop_Data, "m_iClip1") == 0)
			SetEntProp(weapon, Prop_Data, "m_iClip1", 1);
	}
}

public Action OnPlayerUse(int entity, int activator, int caller, UseType type, float value)
{
	SDKUnhook(entity, SDKHook_Use, OnPlayerUse);

	char sClsName[32];
	GetEntityClassname(entity, sClsName, sizeof(sClsName));

	if (strncmp(sClsName[7], "rifle_m60", 9) == 0)
	{
		if (GetEntProp(entity, Prop_Data, "m_iClip1") == 1)
			SetEntProp(entity, Prop_Data, "m_iClip1", 0);
	}
}

Last edited by MasterMind420; 04-02-2020 at 12:06.
MasterMind420 is offline
Shao
Member
Join Date: Jan 2015
Old 05-04-2020 , 03:13   Re: [L4D2] Improved Prevent M60 Drop
Reply With Quote #79

I dunno if that can be helped, but survivors that are being rescued from closet after dying keep their M60 as they respawn. Not game breaking but does clone the M60 in turn.
Shao 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:34.


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