From 2cfb68c6952f8ddbfaf8e28a7d6d205a672a66bd Mon Sep 17 00:00:00 2001 From: esteel Date: Fri, 9 Jan 2009 23:04:37 +0000 Subject: [PATCH] fix voice flood protection git-svn-id: svn://svn.icculus.org/nexuiz/trunk@5480 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/server/cl_player.qc | 7 ++++--- data/qcsrc/server/clientcommands.qc | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 32520b6da..f9cb29d80 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1122,7 +1122,7 @@ void PlayerSound(.string samplefield, float chan, float teamsay) 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 @@ void VoiceMessage(string type, string message) } 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 @@ void VoiceMessage(string type, string message) flood = 1; if (message != "") - Say(self, teamsay, message); + Say(self, ownteam, message); if (!flood) PlayerSound(sample, CHAN_VOICE, teamsay); diff --git a/data/qcsrc/server/clientcommands.qc b/data/qcsrc/server/clientcommands.qc index 2ae232239..05a83acf2 100644 --- a/data/qcsrc/server/clientcommands.qc +++ b/data/qcsrc/server/clientcommands.qc @@ -225,7 +225,10 @@ void SV_ParseClientCommand(string s) { } 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))); -- 2.39.2