r3369 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 13 07:03:17 EST 2008


Author: div0
Date: 2008-02-13 07:03:16 -0500 (Wed, 13 Feb 2008)
New Revision: 3369

Modified:
   trunk/data/qcsrc/server/clientcommands.qc
Log:
allow a reason to be specified for kick votes


Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2008-02-13 11:58:22 UTC (rev 3368)
+++ trunk/data/qcsrc/server/clientcommands.qc	2008-02-13 12:03:16 UTC (rev 3369)
@@ -144,26 +144,38 @@
 }
 
 string GetKickVoteVictim_newcommand;
+string GetKickVoteVictim_reason;
 entity GetKickVoteVictim(string vote, string cmd)
 {
 	float tokens;
-	float i, n;
+	float i, n, t;
 	string ns;
 	entity e;
 
 	tokens = tokenize(vote);
 	ns = "";
 
-	if(tokens == 2)
+	if(tokens >= 2)
 		if(substring(argv(1), 0, 1) == "#")
+		{
 			ns = substring(argv(1), 1, 999);
+			t = 2;
+		}
 	
-	if(tokens == 3)
+	if(tokens >= 3)
 		if(argv(1) == "#")
+		{
 			ns = argv(2);
+			t = 3;
+		}
 
 	if(ns != "")
 	{
+		GetKickVoteVictim_reason = "";
+		for(i = t; i < tokens; ++i)
+			GetKickVoteVictim_reason = strcat(GetKickVoteVictim_reason, argv(i), " ");
+		GetKickVoteVictim_reason = substring(GetKickVoteVictim_reason, 0, strlen(GetKickVoteVictim_reason) - 1);
+		
 		n = stof(ns);
 		if(ns == ftos(n)) if(n >= 1) if(n <= maxclients)
 		{
@@ -249,7 +261,7 @@
 						{
 							if(!(e = GetKickVoteVictim(vote, "vcall")))
 								return;
-							votecalledvote_display = strzone(strcat("^1", vote, " (^7", e.netname, "^1)"));
+							votecalledvote_display = strzone(strcat("^1", vote, " (^7", e.netname, "^1): ", GetKickVoteVictim_reason));
 							vote = GetKickVoteVictim_newcommand;
 						}
 						else
@@ -340,7 +352,7 @@
 					{
 						if(!(e = GetKickVoteVictim(dovote, "vdo")))
 							return;
-						dovote_display = strzone(strcat("^1", dovote, " (^7", e.netname, "^1)"));
+						dovote_display = strzone(strcat("^1", dovote, " (^7", e.netname, "^1): ", GetKickVoteVictim_reason));
 						dovote = GetKickVoteVictim_newcommand;
 					}
 					bprint("\{1}^2* ^3", self.netname, "^2 used his ^3master^2 status to do \"^2", dovote_display, "^2\".\n");




More information about the nexuiz-commits mailing list