Browse Source

Implemented tolerance; defined to 1

pull/13/head
Jessica James 5 years ago
parent
commit
c39cafe639
  1. 7
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp
  2. 3
      src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h

7
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp

@ -41,10 +41,13 @@ void RenX_KickDupesPlugin::RenX_OnPlayerIdentify(RenX::Server &in_server, const
}
// Check to see if any other players on the server have the same HWID
size_t hits{};
for (auto& player : in_server.players) {
if (player.hwid == in_player.hwid && player.id != in_player.id) {
// Two players have the same HWID, but separate player IDs; kick the pre-existing player.
in_server.forceKickPlayer(player, "Ghost client detected"_jrs);
// Two players have the same HWID, but separate player IDs; kick the pre-existing player if there's too many.
if (++hits > s_tolerance) {
in_server.forceKickPlayer(player, "Ghost client detected"_jrs);
}
}
}
}

3
src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h

@ -30,6 +30,9 @@ public: // RenX_KickDupesPlugin
public: // RenX::Plugin
void RenX_OnPlayerIdentify(RenX::Server &server, const RenX::PlayerInfo &player) override;
private:
static constexpr size_t s_tolerance{ 1 };
};
#endif // _RENX_KICKDUPES_H_HEADER

Loading…
Cancel
Save