Raised This Month: $ Target: $400
 0% 

Playing sounds via player voicecomm (RawAudio)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 11-07-2010 , 12:42   Playing sounds via player voicecomm (RawAudio)
Reply With Quote #1

This stock allows you to play a sound to all clients as if some player is saying it through his microphone. It shows the voice activation on the right side of the screen.

You can only play one sound at a time. If there is currently a sound played or a bot is voicechatting the playing is stopped and your sound is played instead.

Huge thanks to javalia, who helped finding out the struct of the RawAudio user message.

PHP Code:
/**
 * Plays a soundfile as if the player is using voicecomm.
 *
 * The voiceindicator is shown on the right, as if the players is talking.
 *
 * @param emitter        The player who's speaking.
 * @param soundfile        Path to the soundfile relative to the sound/ folder.
 * @param length        Length in seconds how long the hud "voiceindicator" is shown.
 * @param pitch            The pitch of the audiofile.
 * @return                True on success, false on failure.
 */
stock bool:SendVoiceCommAll(const emitter, const String:soundfile[], Float:length 0.0pitch 100)
{
    new 
Handle:hBf StartMessageAll("RawAudio");

    if(
hBf != INVALID_HANDLE)
    {
        
BfWriteByte(hBfpitch);
        
BfWriteByte(hBfemitter);
        
BfWriteFloat(hBflength);
        
BfWriteString(hBfsoundfile);
        
EndMessage();
        return 
true;
    }
    return 
false;

__________________
Peace-Maker is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode