Skip to content

Commit

Permalink
Include a fix for knife kill desyncs
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellLVP committed Aug 5, 2020
1 parent ef44e63 commit b3f7ad1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion javascript/features/settings/pawn_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Setting } from 'entities/setting.js';

// List of PawnConfig settings with their unique values and settings. Must be synced with Pawn. The
// settings can be in any category, of any type, as long as the identifier is a valid one.
// Next ID: 19
// Next ID: 20
const kSynchronizedSettings = new Map([
[ 'abuse/disable_out_of_range_damage', { id: 14 } ],
[ 'abuse/fake_car_entry_prevention_enter_ms', { id: 11 } ],
Expand All @@ -17,6 +17,7 @@ const kSynchronizedSettings = new Map([
[ 'abuse/ignore_sole_passenger_damage', { id: 5 } ],
[ 'abuse/kick_reason_public', { id: 6 } ],
[ 'abuse/kill_attribution_time_sec', { id: 7 } ],
[ 'abuse/knife_desync_fix', { id: 19 } ],
[ 'abuse/manual_sawnoff_damage', { id: 13 } ],
[ 'abuse/maximum_connections_per_ip', { id: 18 } ],
[ 'vehicles/drifting_enabled', { id: 1 } ],
Expand Down
1 change: 1 addition & 0 deletions javascript/features/settings/setting_list.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions pawn/Driver/Driver.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,13 @@ public OnPlayerDeath(playerid, killerid, reason) {
if (!g_isDisconnecting[playerid])
SetPlayerHealth(playerid, 100);

// Fixes desyncs caused by killing each other with knifes.
if (reason == WEAPON_KNIFE && g_abuseKnifeDesyncFix) {
new const originalVirtualWorld = GetPlayerVirtualWorld(playerid);
SetPlayerVirtualWorld(playerid, originalVirtualWorld + 1);
SetPlayerVirtualWorld(playerid, originalVirtualWorld);
}

// Corrects the |killerid| when the "ninja jacking" bug has been used, and issues a monitor-
// level abuse report on the player abusing that bug, informing administrators.
if (killerid == INVALID_PLAYER_ID &&
Expand Down
7 changes: 6 additions & 1 deletion pawn/Driver/PawnConfig.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ new g_abuseHighFramerateDamageThreshold = 105;
new bool: g_abuseIgnoreSolePassengerDamage = true;
new bool: g_abuseKickReasonsPublic = true;
new g_abuseKillAttributionTimeSec = 10;
new bool: g_abuseKnifeDesyncFix = true;
new bool: g_abuseManualSawnoffDamage = false;
new g_maximumConnectionsPerIP = 3;

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

// These are the unique Ids for each of the properties that can be updated. They must be identical
// between the Pawn and the JavaScript code.
// Next ID: 19
// Next ID: 20
enum PawnConfigProperty {
kAbuseDisableOutOfRangeDamage = 14,
kAbuseFakeCarEntryPreventionEnterMs = 11,
Expand All @@ -42,6 +43,7 @@ enum PawnConfigProperty {
kAbuseIgnoreSolePassengerDamage = 5,
kAbuseKickReasonPublic = 6,
kAbuseKillAttributionTimeSec = 7,
kAbuseKnifeDesyncFix = 19,
kAbuseManualSawnoffDamage = 13,
kAbuseMaximumConnectionsPerIP = 18,
kVehiclesDriftingEnabled = 1,
Expand Down Expand Up @@ -87,6 +89,9 @@ public OnPawnConfigDataChange(PawnConfigProperty: property, Float: numberValue)
case kAbuseKillAttributionTimeSec:
g_abuseKillAttributionTimeSec = intValue;

case kAbuseKnifeDesyncFix:
g_abuseKnifeDesyncFix = !!intValue;

case kAbuseManualSawnoffDamage:
g_abuseManualSawnoffDamage = !!intValue;

Expand Down

0 comments on commit b3f7ad1

Please sign in to comment.