aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NorthstarDedicatedTest/bansystem.cpp15
-rw-r--r--NorthstarDedicatedTest/bansystem.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/NorthstarDedicatedTest/bansystem.cpp b/NorthstarDedicatedTest/bansystem.cpp
index 182506e8..610c20e4 100644
--- a/NorthstarDedicatedTest/bansystem.cpp
+++ b/NorthstarDedicatedTest/bansystem.cpp
@@ -28,6 +28,15 @@ void ServerBanSystem::OpenBanlist()
m_sBanlistStream.open(BANLIST_PATH, std::ofstream::out | std::ofstream::binary | std::ofstream::app);
}
+void ServerBanSystem::ClearBanlist()
+{
+ m_vBannedUids.clear();
+
+ // reopen the file, don't provide std::ofstream::app so it clears on open
+ m_sBanlistStream.close();
+ m_sBanlistStream.open(BANLIST_PATH, std::ofstream::out | std::ofstream::binary);
+}
+
void ServerBanSystem::BanUID(uint64_t uid)
{
m_vBannedUids.push_back(uid);
@@ -80,6 +89,11 @@ void UnbanPlayerCommand(const CCommand& args)
g_ServerBanSystem->UnbanUID(strtoll(args.Arg(1), nullptr, 10));
}
+void ClearBanlistCommand(const CCommand& args)
+{
+ g_ServerBanSystem->ClearBanlist();
+}
+
void InitialiseBanSystem(HMODULE baseAddress)
{
g_ServerBanSystem = new ServerBanSystem;
@@ -87,4 +101,5 @@ void InitialiseBanSystem(HMODULE baseAddress)
RegisterConCommand("ban", BanPlayerCommand, "bans a given player by uid or name", FCVAR_GAMEDLL);
RegisterConCommand("unban", UnbanPlayerCommand, "unbans a given player by uid", FCVAR_NONE);
+ RegisterConCommand("clearbanlist", ClearBanlistCommand, "clears all uids on the banlist", FCVAR_NONE);
} \ No newline at end of file
diff --git a/NorthstarDedicatedTest/bansystem.h b/NorthstarDedicatedTest/bansystem.h
index a1646356..8ce05308 100644
--- a/NorthstarDedicatedTest/bansystem.h
+++ b/NorthstarDedicatedTest/bansystem.h
@@ -9,6 +9,7 @@ private:
public:
void OpenBanlist();
+ void ClearBanlist();
void BanUID(uint64_t uid);
void UnbanUID(uint64_t uid);
bool IsUIDAllowed(uint64_t uid);