about summary refs log tree commit diff
path: root/src/game/server
diff options
context:
space:
mode:
authorTeetime <TeetimeTW@yahoo.de>2011-11-19 13:40:13 +0100
committerTeetime <TeetimeTW@yahoo.de>2011-11-19 13:40:13 +0100
commite3bbef1a454a291ce9ee48313c9ceafaf95b5f59 (patch)
treefb42c14b704053fc984f990ba1fc4691b152ce0a /src/game/server
parent8197bc22a5cfe77d07cb199b7e2a7f1cdf123fa0 (diff)
downloadzcatch-e3bbef1a454a291ce9ee48313c9ceafaf95b5f59.tar.gz
zcatch-e3bbef1a454a291ce9ee48313c9ceafaf95b5f59.zip
changed suicide-functions
Diffstat (limited to 'src/game/server')
-rw-r--r--src/game/server/gamecontext.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp
index 403f782e..b345ec8c 100644
--- a/src/game/server/gamecontext.cpp
+++ b/src/game/server/gamecontext.cpp
@@ -1131,24 +1131,32 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
 	else if (MsgID == NETMSGTYPE_CL_KILL && !m_World.m_Paused)
 	{
 		/* begin zCatch*/
-		if((pPlayer->GetTeam() == TEAM_SPECTATORS) || (pPlayer->m_LastKillTry && pPlayer->m_LastKillTry+Server()->TickSpeed()*2 > Server()->Tick()))
+		if(pPlayer->GetTeam() == TEAM_SPECTATORS || (pPlayer->m_LastKill && pPlayer->m_LastKill+Server()->TickSpeed()*3 > Server()->Tick()) ||
+				(pPlayer->m_LastKillTry+Server()->TickSpeed()*3 > Server()->Tick()))
 			return;
 
-		if(pPlayer->GetCharacter() && pPlayer->GetCharacter()->m_FreezeTicks)
+		if(g_Config.m_SvSuicideTime == 0)
 		{
-			SendChatTarget(ClientID, "You can't kill yourself while you're frozen");
-			pPlayer->m_LastKillTry = Server()->Tick();
+			SendChatTarget(ClientID, "Suicide is not allowed.");
 		}
-		else if(pPlayer->m_LastKill && pPlayer->m_LastKill + Server()->TickSpeed()*15 > Server()->Tick())
-		{	
-			SendBroadcast("Only one kill in 15sec is allowed.", ClientID);
+		else if(pPlayer->m_LastKill && pPlayer->m_LastKill+Server()->TickSpeed()*g_Config.m_SvSuicideTime > Server()->Tick())
+		{
+			char aBuf[128];
+			str_format(aBuf, sizeof(aBuf), "Only one suicide every %d seconds is allowed.", g_Config.m_SvSuicideTime);
+			SendChatTarget(ClientID, aBuf);
+		}
+		else if(pPlayer->GetCharacter() && pPlayer->GetCharacter()->m_FreezeTicks)
+		{
+			SendChatTarget(ClientID, "You can't kill yourself while you're frozen.");
 		}
 		else
 		{
 			pPlayer->m_LastKill = Server()->Tick();
 			pPlayer->KillCharacter(WEAPON_SELF);
 			pPlayer->m_Deaths++;
+			return;
 		}
+		pPlayer->m_LastKillTry = Server()->Tick();
 		/* end zCatch*/
 	}
 }