r5480 - trunk/data/qcsrc/server

esteel at icculus.org esteel at icculus.org
Fri Jan 9 18:04:37 EST 2009


Author: esteel
Date: 2009-01-09 18:04:37 -0500 (Fri, 09 Jan 2009)
New Revision: 5480

Modified:
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/clientcommands.qc
Log:
fix voice flood protection

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2009-01-09 22:00:57 UTC (rev 5479)
+++ trunk/data/qcsrc/server/cl_player.qc	2009-01-09 23:04:37 UTC (rev 5480)
@@ -1122,7 +1122,7 @@
 void VoiceMessage(string type, string message)
 {
 	var .string sample;
-	var float teamsay;
+	var float teamsay, ownteam;
 	sample = GetVoiceMessageSampleField(type);
 
 	if(GetPlayerSoundSampleField_notFound)
@@ -1132,13 +1132,14 @@
 	}
 
 	teamsay = GetVoiceMessageTeamsayType(type);
+	ownteam = (teamsay == 1);
 
 	float flood;
 	float flood_spv;
 	var .float flood_field;
 
 	flood = 0;
-	if(teamsay == 1)
+	if(ownteam)
 	{
 		flood_spv = cvar("g_voice_flood_spv_team");
 		flood_field = floodcontrol_voiceteam;
@@ -1155,7 +1156,7 @@
 		flood = 1;
 
 	if (message != "")
-		Say(self, teamsay, message);
+		Say(self, ownteam, message);
 
 	if (!flood)
 		PlayerSound(sample, CHAN_VOICE, teamsay);

Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc	2009-01-09 22:00:57 UTC (rev 5479)
+++ trunk/data/qcsrc/server/clientcommands.qc	2009-01-09 23:04:37 UTC (rev 5480)
@@ -225,7 +225,10 @@
 	} else if(argv(0) == "records") {
 		sprint(self, records_reply);
 	} else if(argv(0) == "voice") {
-		VoiceMessage(argv(1), substring(s, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
+		if(tokens >= 3)
+			VoiceMessage(argv(1), substring(s, argv_start_index(2), argv_end_index(-1) - argv_start_index(2)));
+		else
+			VoiceMessage(argv(1), "");
 	} else if(argv(0) == "say") {
 		if(tokens >= 2)
 			Say(self, FALSE, substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));




More information about the nexuiz-commits mailing list