Skip to content

Commit b3f7ad1

Browse files
committed
Include a fix for knife kill desyncs
1 parent ef44e63 commit b3f7ad1

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

javascript/features/settings/pawn_config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Setting } from 'entities/setting.js';
66

77
// List of PawnConfig settings with their unique values and settings. Must be synced with Pawn. The
88
// settings can be in any category, of any type, as long as the identifier is a valid one.
9-
// Next ID: 19
9+
// Next ID: 20
1010
const kSynchronizedSettings = new Map([
1111
[ 'abuse/disable_out_of_range_damage', { id: 14 } ],
1212
[ 'abuse/fake_car_entry_prevention_enter_ms', { id: 11 } ],
@@ -17,6 +17,7 @@ const kSynchronizedSettings = new Map([
1717
[ 'abuse/ignore_sole_passenger_damage', { id: 5 } ],
1818
[ 'abuse/kick_reason_public', { id: 6 } ],
1919
[ 'abuse/kill_attribution_time_sec', { id: 7 } ],
20+
[ 'abuse/knife_desync_fix', { id: 19 } ],
2021
[ 'abuse/manual_sawnoff_damage', { id: 13 } ],
2122
[ 'abuse/maximum_connections_per_ip', { id: 18 } ],
2223
[ 'vehicles/drifting_enabled', { id: 1 } ],

javascript/features/settings/setting_list.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pawn/Driver/Driver.pwn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,13 @@ public OnPlayerDeath(playerid, killerid, reason) {
569569
if (!g_isDisconnecting[playerid])
570570
SetPlayerHealth(playerid, 100);
571571

572+
// Fixes desyncs caused by killing each other with knifes.
573+
if (reason == WEAPON_KNIFE && g_abuseKnifeDesyncFix) {
574+
new const originalVirtualWorld = GetPlayerVirtualWorld(playerid);
575+
SetPlayerVirtualWorld(playerid, originalVirtualWorld + 1);
576+
SetPlayerVirtualWorld(playerid, originalVirtualWorld);
577+
}
578+
572579
// Corrects the |killerid| when the "ninja jacking" bug has been used, and issues a monitor-
573580
// level abuse report on the player abusing that bug, informing administrators.
574581
if (killerid == INVALID_PLAYER_ID &&

pawn/Driver/PawnConfig.pwn

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ new g_abuseHighFramerateDamageThreshold = 105;
1515
new bool: g_abuseIgnoreSolePassengerDamage = true;
1616
new bool: g_abuseKickReasonsPublic = true;
1717
new g_abuseKillAttributionTimeSec = 10;
18+
new bool: g_abuseKnifeDesyncFix = true;
1819
new bool: g_abuseManualSawnoffDamage = false;
1920
new g_maximumConnectionsPerIP = 3;
2021

@@ -31,7 +32,7 @@ new bool: g_vehicleKeysBlockedInLasVenturas = true;
3132

3233
// These are the unique Ids for each of the properties that can be updated. They must be identical
3334
// between the Pawn and the JavaScript code.
34-
// Next ID: 19
35+
// Next ID: 20
3536
enum PawnConfigProperty {
3637
kAbuseDisableOutOfRangeDamage = 14,
3738
kAbuseFakeCarEntryPreventionEnterMs = 11,
@@ -42,6 +43,7 @@ enum PawnConfigProperty {
4243
kAbuseIgnoreSolePassengerDamage = 5,
4344
kAbuseKickReasonPublic = 6,
4445
kAbuseKillAttributionTimeSec = 7,
46+
kAbuseKnifeDesyncFix = 19,
4547
kAbuseManualSawnoffDamage = 13,
4648
kAbuseMaximumConnectionsPerIP = 18,
4749
kVehiclesDriftingEnabled = 1,
@@ -87,6 +89,9 @@ public OnPawnConfigDataChange(PawnConfigProperty: property, Float: numberValue)
8789
case kAbuseKillAttributionTimeSec:
8890
g_abuseKillAttributionTimeSec = intValue;
8991

92+
case kAbuseKnifeDesyncFix:
93+
g_abuseKnifeDesyncFix = !!intValue;
94+
9095
case kAbuseManualSawnoffDamage:
9196
g_abuseManualSawnoffDamage = !!intValue;
9297

0 commit comments

Comments
 (0)