First of all, at once I want to tell that I won't write any details, as badly I know English, therefore you should study a code and from it to do your conclusions.
Such method of conversation of bots is traditionally used:
1) The bot sends to clients (sv_alltalk 0 - teammates, 1 - all) the game message "BotVoice" to display a voice icon above bot head.
2) Afterwards, the bot sends to the same clients also the game message "SendAudio", which forces to play a sound chosen by a bot (a word, a phrase), which he "speaks", thus the client to hear this sound must have this sound in their computer, in the same folder, as on the server, and also this sound at the client shouldn't differ from the original - since the bot phrase can lose any meaning for the client...
3) When the sound playing is came to an end the bot again sends to the same clients the game message "BotVoice" to hide a voice icon.
Lacks:
1) The client must have an identical file of a playing sound, in a certain folder.
2) The bot doesn't moving his mouth when speaks.
3) There is no possibility dynamically to change a sound (volume, pitch, and other) to do sequence of sounds.
4) There is no normal possibility to stop sound playing.
5) There is no possibility to use voice engines such as SAPI.
It probably everything that I have remembered, however I think that it not the complete list....
New method:
1) Loading of the raw sound data from a file, their transformation at desire (for example converting from what or a format to WAV, change of volume, pitch and other).
2) Compression of the data by means of the sound codec. (known codecs: "voice_miles", "voice_speex")
3) Transmit compressed data to clients (sv_alltalk 0 - to teammates, 1 - all) by the engine message "SVC_VOICEDATA".
Note: transmit takes place each frame by a certain number of bytes.
HERE the code.
All should work, however in that kind in which there is a code in archive I didn't check on working capacity, as it simply piece from my bot...
if you have any questions, ask, I will try to answer, but I want to say beforehand that I badly understand all this, especially in SAPI, base of SAPI code I took from
HERE.
Thanks!
Try it in my
BOT
1) Unpack containing in archive to "cstrike" directory;
2) Change line "gamedll "dlls/mp.dll"" in "cstrike/liblist.gam" to "gamedll "addons/yapb/dlls/yapb.dll"";
3) Create server;
4) Type in console:
4.1) "yb_stop 1";
4.2) "yb_quota 1";
4.3) "yb_communication 4";
5) connect to bot team;
6) Press USE button and hold it - by default bot will speak voice_input.WAV sound, to change it, and switch to SAPI type "yb_voice_inputfromfile 0" and repeat this point (NOTE: you should have installed SAPI and registered simpleaudio.DLL).
I hope you do not get eny errors and your server will not crash :{P
P.S.: Sorry for bad english....