Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

[Plugin] Voice Plugin

$
0
0
Description:
The plugin will allow you to receive and send voice packets, creating voice systems. This opens up great opportunities for Pawn-developers.

Main features:
  • Receiving voice packets
  • Sending voice packets to specified players
  • The plugin uses the BASS library and the OPUS codec

Simple example:
PHP Code:

#include <a_samp>
#include <voice>

#undef MAX_PLAYERS
#define MAX_PLAYERS 100

// PRESSED(keys)
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

// RELEASED(keys)
#define RELEASED(%0) \
    
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

    
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    
// Press Y
    
if(PRESSED(KEY_YES)) StartVoice(playerid);
    
// Release Y
    
if(RELEASED(KEY_YES)) StopVoice(playerid);

    return 
1;
}

public 
OnPlayerVoice(playeridBitStream:bs)
{
    
// Add Text
    
SetPlayerChatBubble(playerid"Speaker"COLOR_WHITE10.001000);

    
// Get Player Voice Pos
    
new Float:pos[3];
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    
    
// Foreach Players
    
for(new 0MAX_PLAYERSi++)
    {
        if(
playerid == i) continue;
        if(!
IsPlayerConnected(i)) continue;
        
        
// Set param 10.00 distance
        
if(IsPlayerInRangeOfPoint(i10.00pos[0], pos[1], pos[2])) {
            
SendVoice(ibs);
        }
    }
    
    return 
1;


Binaries:
https://sampvoice.com/

Viewing all articles
Browse latest Browse all 18226

Trending Articles