You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the changematch path (!chmatch) configs would consider modified weapon info as "vanilla", simply caused by the fact that it wouldn't finish resetting the weapon attributes before dependencies were unloaded.
Copy file name to clipboardExpand all lines: addons/sourcemod/scripting/l4d2_weapon_attributes.sp
+32-16Lines changed: 32 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -214,7 +214,7 @@ public Plugin myinfo =
214
214
{
215
215
name="L4D2 Weapon Attributes",
216
216
author="Jahze, A1m`, Forgetest",
217
-
version="3.0.1",
217
+
version="3.1.0",
218
218
description="Allowing tweaking of the attributes of all weapons"
219
219
};
220
220
@@ -272,11 +272,21 @@ public void OnConfigsExecuted()
272
272
// Weapon info may get reloaded, and supported melees
273
273
// are different between campaigns.
274
274
// Here we are reloading all the attributes set by our own.
275
-
276
275
ResetWeaponAttributes(false);
277
276
ResetMeleeAttributes(false);
278
277
}
279
278
279
+
/*
280
+
Fired by confoglcompmod before confogl_off.cfg runs and before any plugin
281
+
(including left4dhooks, whose natives we need for the reset) gets unloaded.
282
+
Without this, on !chmatch the engine-side weapon info keeps the previous
283
+
matchmode's values
284
+
*/
285
+
publicvoidLGO_OnMatchModeUnloaded()
286
+
{
287
+
ResetAllAttributes(false);
288
+
}
289
+
280
290
voidOnTankDamageEnableAttriChanged(boolnewValue)
281
291
{
282
292
if (bTankDamageEnableAttri!=newValue) {
@@ -506,38 +516,44 @@ Action Cmd_WeaponAttributes(int client, int args)
506
516
}
507
517
508
518
ActionCmd_WeaponAttributesReset(intargs)
519
+
{
520
+
ResetAllAttributes(true);
521
+
returnPlugin_Handled;
522
+
}
523
+
524
+
voidResetAllAttributes(boolbVerbose)
509
525
{
510
526
OnTankDamageEnableAttriChanged(false);
511
-
527
+
512
528
boolIsReset= (hTankDamageAttri.Size>0);
513
529
hTankDamageAttri.Clear();
514
-
515
-
if (IsReset) {
530
+
531
+
if (bVerbose&&IsReset) {
516
532
PrintToServer("Tank Damage Multiplier (tankdamagemult) attribute reset for all weapons!");
517
533
}
518
-
534
+
535
+
OnReloadDurationEnableAttriChanged(false);
536
+
519
537
IsReset= (hReloadDurationAttri.Size>0);
520
538
hReloadDurationAttri.Clear();
521
-
522
-
if (IsReset) {
539
+
540
+
if (bVerbose&&IsReset) {
523
541
PrintToServer("Reload Duration Multiplier (reloaddurationmult) attribute reset for all shotguns!");
524
542
}
525
-
543
+
526
544
intiWeaponAttrCount=ResetWeaponAttributes(true);
527
-
if (iWeaponAttrCount==0) {
545
+
if (bVerbose&&iWeaponAttrCount==0) {
528
546
PrintToServer("Weapon attributes were not reset, because no weapon attributes were saved!");
529
547
}
530
-
548
+
531
549
intiMeleeAttrCount=ResetMeleeAttributes(true);
532
-
if (iMeleeAttrCount==0) {
550
+
if (bVerbose&&iMeleeAttrCount==0) {
533
551
PrintToServer("Melee attributes were not reset, because no melee attributes were saved!");
534
552
}
535
-
536
-
if (iWeaponAttrCount||iMeleeAttrCount) {
553
+
554
+
if (bVerbose&& (iWeaponAttrCount||iMeleeAttrCount)) {
537
555
PrintToServer("The weapon attributes for all saved weapons have been reset successfully. Number of reset weapon attributes: %d!", iWeaponAttrCount+iMeleeAttrCount);
0 commit comments