Skip to content

Commit

Permalink
Fix: abuse prevention should supersede a SA-MP bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RussellLVP committed Jun 21, 2020
1 parent 69ace6f commit a083a51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
8 changes: 8 additions & 0 deletions pawn/Driver/Driver.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ public OnPlayerDeath(playerid, killerid, reason) {
}
}

// If `/kill` was used, it's possible that the death might be attributed to an invalid player
// due to a SA-MP bug. Reset the |killerid| when this happens. Kill attribution for command
// abuse will still be able to set the |killerid| to another player Id, however.
if (preventKillLamers[playerid]) {
killerid = INVALID_PLAYER_ID;
preventKillLamers[playerid] = 0;
}

// If the |playerid| has killed themselves, or through other means wants to avoid getting an
// attributed kill from their opponent, we'll make sure we do it for them.
if (killerid == INVALID_PLAYER_ID && g_lastTakenDamageTime[playerid] > 0 &&
Expand Down
12 changes: 0 additions & 12 deletions pawn/Resources/Callbacks/OnPlayer/OnPlayerDeath.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ LegacyPlayerDeath(playerid, killerid, reason) {
ClearPlayerMenus(playerid);
iPlayerSesDeaths[playerid]++;

#if Feature::DisableFights == 0
// An admin might use /kill in a fight, in which case we don't reset the killerid.
if (preventKillLamers[playerid] && CFightClub__IsPlayerFighting(playerid))
preventKillLamers[playerid] = 0;
#endif

// SA:MP bug where killerid is still defined after /kill.
if (preventKillLamers[playerid]) {
killerid = Player::InvalidId;
preventKillLamers[playerid] = 0;
}

// Disallow self-nading to suicide when the player has been hit in the last 15 seconds.
if (killerid == Player::InvalidId && reason == WEAPON_NONE && (Time->currentTime() - DamageManager(playerid)->getLastHitTime()) < 15)
LegacySetValidKillerVariables(playerid, DamageManager(playerid)->getLastHitId(), WEAPON_EXPLOSION);
Expand Down
2 changes: 1 addition & 1 deletion pawn/config.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
class Version {
public const Major = 49;
public const Minor = 0;
public const Minor = 1;
};

// Set this to 1 if you'd like to build Las Venturas Playground in release mode. This affects
Expand Down

0 comments on commit a083a51

Please sign in to comment.