| 421 | } |
| 422 | |
| 423 | void voicecom(char *sound, char *text) |
| 424 | { |
| 425 | if(!sound || !sound[0]) return; |
| 426 | if(!text || !text[0]) return; |
| 427 | static int last = 0; |
| 428 | if(!last || lastmillis-last > 2000) |
| 429 | { |
| 430 | defformatstring(soundpath)("voicecom/%s", sound); |
| 431 | int s = audiomgr.findsound(soundpath, 0, gamesounds); |
| 432 | if(!gamesound_isvoicecom(s)) return; |
| 433 | if(voicecomsounds>0) audiomgr.playsound(s, SP_HIGH); |
| 434 | if(gamesound_ispublicvoicecom(s)||(!m_teammode&&gamesound_ispublicwhenffa(s))) // public |
| 435 | { |
| 436 | addmsg(SV_VOICECOM, "ri", s); |
| 437 | toserver(text); |
| 438 | } |
| 439 | else // team |
| 440 | { |
| 441 | if(gamesound_isflagvoicecom(s)?!m_flags_:true) |
| 442 | { |
| 443 | addmsg(SV_VOICECOMTEAM, "ri", s); |
| 444 | defformatstring(teamtext)("%c%s", '%', text); |
| 445 | toserver(teamtext); |
| 446 | } |
| 447 | } |
| 448 | last = lastmillis; |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | COMMAND(voicecom, "ss"); |
| 453 | |