+void FakeGlobalSound(string sample, float chan, float voicetype)
+{
+ float n;
+ float tauntrand;
+
+ if(sample == "")
+ return;
+
+ tokenize_console(sample);
+ n = stof(argv(1));
+ if(n > 0)
+ sample = strcat(argv(0), ftos(floor(random() * n + 1)), ".wav"); // randomization
+ else
+ sample = strcat(argv(0), ".wav"); // randomization
+
+ switch(voicetype)
+ {
+ case VOICETYPE_LASTATTACKER_ONLY:
+ break;
+ case VOICETYPE_LASTATTACKER:
+ if(self.pusher)
+ {
+ msg_entity = self;
+ if(clienttype(msg_entity) == CLIENTTYPE_REAL)
+ soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
+ }
+ break;
+ case VOICETYPE_TEAMRADIO:
+ msg_entity = self;
+ if(msg_entity.cvar_cl_voice_directional == 1)
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
+ else
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);
+ break;
+ case VOICETYPE_AUTOTAUNT:
+ if(!sv_autotaunt)
+ break;
+ if(!sv_taunt)
+ break;
+ if(sv_gentle)
+ break;
+ tauntrand = random();
+ msg_entity = self;
+ if (tauntrand < msg_entity.cvar_cl_autotaunt)
+ {
+ if (msg_entity.cvar_cl_voice_directional >= 1)
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));
+ else
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);
+ }
+ break;
+ case VOICETYPE_TAUNT:
+ if(self.classname == "player")
+ if(self.deadflag == DEAD_NO)
+ setanim(self, self.anim_taunt, FALSE, TRUE, TRUE);
+ if(!sv_taunt)
+ break;
+ if(sv_gentle)
+ break;
+ msg_entity = self;
+ if (msg_entity.cvar_cl_voice_directional >= 1)
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));
+ else
+ soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);
+ break;
+ case VOICETYPE_PLAYERSOUND:
+ msg_entity = self;
+ soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NORM);
+ break;
+ default:
+ backtrace("Invalid voice type!");
+ break;
+ }
+}
+