Skip to content

Commit

Permalink
Implemented tolerance; defined to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JAJames committed Jan 25, 2020
1 parent e72fa24 commit c39cafe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.cpp
Expand Up @@ -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);
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/Plugins/RenX/RenX.KickDupes/RenX_KickDupes.h
Expand Up @@ -30,6 +30,9 @@ class RenX_KickDupesPlugin : public RenX::Plugin

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

0 comments on commit c39cafe

Please sign in to comment.