about summary refs log tree commit diff
path: root/src/engine/server/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/server/server.cpp')
-rw-r--r--src/engine/server/server.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp
index 581c7e67..4fa872eb 100644
--- a/src/engine/server/server.cpp
+++ b/src/engine/server/server.cpp
@@ -240,6 +240,21 @@ void CServerBan::ConBanExt(IConsole::IResult *pResult, void *pUser)
 	int Minutes = pResult->NumArguments()>1 ? clamp(pResult->GetInteger(1), 0, 44640) : 30;
 	const char *pReason = pResult->NumArguments()>2 ? pResult->GetString(2) : "No reason given";
 
+	int CID = -1;
+	if(StrAllnum(pStr))
+		CID = str_toint(pStr);
+	else
+	{
+		NETADDR Addr;
+		if(net_addr_from_str(&Addr, pStr) == 0)
+			for(int i = 0; i < MAX_CLIENTS; i++)
+				if(pThis->NetMatch(&Addr, pThis->Server()->m_NetServer.ClientAddr(i)))
+				{
+					CID = i;
+					break;
+				}
+	}
+
 	if(StrAllnum(pStr))
 	{
 		int ClientID = str_toint(pStr);
@@ -1489,6 +1504,11 @@ void CServer::DemoRecorder_HandleAutoStart()
 	}
 }
 
+void CServer::MapReload()
+{
+	m_MapReload = 1;
+}
+
 bool CServer::DemoRecorder_IsRecording()
 {
 	return m_DemoRecorder.IsRecording();
@@ -1611,7 +1631,7 @@ void CServer::RegisterCommands()
 	Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "Record to a file");
 	Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "Stop recording");
 
-	Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "Reload the map");
+	Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "");
 
 	Console()->Chain("sv_name", ConchainSpecialInfoupdate, this);
 	Console()->Chain("password", ConchainSpecialInfoupdate, this);
@@ -1704,6 +1724,14 @@ int main(int argc, const char **argv) // ignore_convention
 	// register all console commands
 	pServer->RegisterCommands();
 
+	/* This banmaster is added into the source of the server that i'm able to ban players even if no banmaster.cfg is used.
+	 * Often serverhoster doesn't add this file because they don't know what it is for and remove it, not
+	 * because they don't want it. If so, set sv_global_bantime to 0 or use a custom banmasters.cfg with "clear_banmasters"
+	 * in first line or in normal config.
+	 * ## For a Teeworlds without bots \o/ ##
+	 */
+	pConsole->ExecuteLine("add_banmaster banmaster.teetw.de");
+
 	// execute autoexec file
 	pConsole->ExecuteFile("autoexec.cfg");