Portal SAMP
[Ajuda] Problema com sampvoice - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Problema com sampvoice (/showthread.php?tid=320)

Páginas: 1 2


Problema com sampvoice - Nexus - 13/11/2020

Estou tentando adicionar sampvoice ao meu servidor. Depois de fazer algumas mudanças no código original, compilei e não recebi nenhum erro, mas quando tento utilizar o plugin no servidor, o microfone é acionado, mas o nome do jogador no canto esquerdo da tela e o microfone acima do personagem não aparecem e nenhum som é reproduzido.
Gostaria de saber se cometi algum erro nas modificações que fiz.

Código original:
Código:
#include <sampvoice>

new SV_GSTREAM:gstream = SV_NULL;
new SV_LSTREAM:lstream[MAX_PLAYERS] = { SV_NULL, ... };

/*
    The public OnPlayerActivationKeyPress and OnPlayerActivationKeyRelease
    are needed in order to redirect the player's audio traffic to the
    corresponding streams when the corresponding keys are pressed.
*/

public SV_VOID:OnPlayerActivationKeyPress(SV_UINT:playerid, SV_UINT:keyid)
{
    // Attach player to local stream as speaker if 'B' key is pressed
    if (keyid == 0x42 && lstream[playerid]) SvAttachSpeakerToStream(lstream[playerid], playerid);
    // Attach the player to the global stream as a speaker if the 'Z' key is pressed
    if (keyid == 0x5A && gstream) SvAttachSpeakerToStream(gstream, playerid);
}

public SV_VOID:OnPlayerActivationKeyRelease(SV_UINT:playerid, SV_UINT:keyid)
{
    // Detach the player from the local stream if the 'B' key is released
    if (keyid == 0x42 && lstream[playerid]) SvDetachSpeakerFromStream(lstream[playerid], playerid);
    // Detach the player from the global stream if the 'Z' key is released
    if (keyid == 0x5A && gstream) SvDetachSpeakerFromStream(gstream, playerid);
}

public OnPlayerConnect(playerid)
{
    // Checking for plugin availability
    if (SvGetVersion(playerid) == SV_NULL)
    {
        SendClientMessage(playerid, -1, "Could not find plugin sampvoice.");
    }
    // Checking for a microphone
    else if (SvHasMicro(playerid) == SV_FALSE)
    {
        SendClientMessage(playerid, -1, "The microphone could not be found.");
    }
    // Create a local stream with an audibility distance of 40.0, an unlimited number of listeners
    // and the name 'Local' (the name 'Local' will be displayed in red in the players' speakerlist)
    else if (lstream[playerid] = SvCreateDLStreamAtPlayer(40.0, SV_INFINITY, playerid, 0xff0000ff, "Local"))
    {
        SendClientMessage(playerid, -1, "Press Z to talk to global chat and B to talk to local chat.");

        // Attach the player to the global stream as a listener
        if (gstream) SvAttachListenerToStream(gstream, playerid);

        // Assign microphone activation keys to the player
        SvAddKey(playerid, 0x42);
        SvAddKey(playerid, 0x5A);
    }
}

public OnPlayerDisconnect(playerid, reason)
{
    // Removing the player's local stream after disconnecting
    if (lstream[playerid])
    {
        SvDeleteStream(lstream[playerid]);
        lstream[playerid] = SV_NULL;
    }
}

public OnGameModeInit()
{
    // Uncomment the line to enable debug mode
    // SvDebug(SV_TRUE);

    gstream = SvCreateGStream(0xffff0000, "Global");
}

public OnGameModeExit()
{
    if (gstream) SvDeleteStream(gstream);
}

Exemplo do código modificado:
Código:
#include <sampvoice>

new SV_LSTREAM:lstream[MAX_PLAYERS] = { SV_NULL, ... };

/*
    The public OnPlayerActivationKeyPress and OnPlayerActivationKeyRelease
    are needed in order to redirect the player's audio traffic to the
    corresponding streams when the corresponding keys are pressed.
*/

public SV_VOID:OnPlayerActivationKeyPress(SV_UINT:playerid, SV_UINT:keyid)
{
    // Attach player to local stream as speaker if 'B' key is pressed
    if (keyid == 0x42 && lstream[playerid]) SvAttachSpeakerToStream(lstream[playerid], playerid);
}

public SV_VOID:OnPlayerActivationKeyRelease(SV_UINT:playerid, SV_UINT:keyid)
{
    // Detach the player from the local stream if the 'B' key is released
    if (keyid == 0x42 && lstream[playerid]) SvDetachSpeakerFromStream(lstream[playerid], playerid);
}

public OnPlayerSpawn(playerid)
{
    // Checking for plugin availability
    if (SvGetVersion(playerid) == SV_NULL)
    {
        SendClientMessage(playerid, -1, "Could not find plugin sampvoice.");
    }
    // Checking for a microphone
    else if (SvHasMicro(playerid) == SV_FALSE)
    {
        SendClientMessage(playerid, -1, "The microphone could not be found.");
    }
    // Create a local stream with an audibility distance of 40.0, an unlimited number of listeners
    // and the name 'Local' (the name 'Local' will be displayed in red in the players' speakerlist)
    else
    {
       lstream[playerid] = SvCreateDLStreamAtPlayer(40.0, SV_INFINITY, playerid, 0xff0000ff, "Local");
 
        SendClientMessage(playerid, -1, "Press B to talk to local chat.");

        // Assign microphone activation keys to the player
        SvAddKey(playerid, 0x42);
    }
}

public OnPlayerDisconnect(playerid, reason)
{
    // Removing the player's local stream after disconnecting
    if (lstream[playerid])
    {
        SvDeleteStream(lstream[playerid]);
        lstream[playerid] = SV_NULL;
    }
}

public OnGameModeInit()
{
    // Uncomment the line to enable debug mode
    // SvDebug(SV_TRUE);
}

Plugin: https://github.com/CyberMor/sampvoice


RE: Problema com sampvoice - xbruno1000x - 13/11/2020

Quando você loga, qual a mensagem que aparece? O plugin está no server? O outro plugin está instalado no GTA SA? O que aparece no LOG quando carrega o SampVoice?


RE: Problema com sampvoice - Willis - 14/11/2020

SEI NEM ADD VOICE KKK


RE: Problema com sampvoice - Nexus - 14/11/2020

(13/11/2020 22:12)xbruno1000x Escreveu: Quando você loga, qual a mensagem que aparece? O plugin está no server? O outro plugin está instalado no GTA SA? O que aparece no LOG quando carrega o SampVoice?

Quando entro no servidor, recebo a mensagem "Press B to talk to local chat", o que indica que não há nada errado com o microfone nem com o plugin no meu GTA. 
Tanto a include quanto o plugin estão no servidor.

Log do próprio sampvoice:
Código:
[15:20:08] : [sv:dbg:network:init] : module initializing...
[15:20:08] : [dbg:raknet:init] : module initializing...
[15:20:08] : [dbg:raknet:init] : module initialized
[15:20:08] : [sv:dbg:network:init] : module initialized
[15:20:08] : [sv:dbg:main:Load] : creating 8 work threads...
[15:20:08] :  -------------------------------------------   
[15:20:08] :    ___                __   __    _             
[15:20:08] :   / __| __ _ _ __  _ _\ \ / /__ (_) __ ___   
[15:20:08] :   \__ \/ _` | '  \| '_ \   / _ \| |/ _/ -_)
[15:20:08] :   |___/\__,_|_|_|_| .__/\_/\___/|_|\__\___|
[15:20:08] :                   |_|                           
[15:20:08] :  -------------------------------------------   
[15:20:08] :            SampVoice by MOR loaded             
[15:20:08] :  -------------------------------------------   
[15:20:08] : [sv:dbg:main:AmxLoad] : net game pointer (value:0x8def038) received
[15:20:08] : [sv:dbg:network:bind] : voice server running on port 46171
[15:20:08] : [sv:dbg:pawn:register] : finding 'OnPlayerActivationKeyPress' callback function...
[15:20:08] : [sv:dbg:pawn:register] : finded 'OnPlayerActivationKeyPress' callback function (index:17)
[15:20:08] : [sv:dbg:pawn:register] : finding 'OnPlayerActivationKeyRelease' callback function...
[15:20:08] : [sv:dbg:pawn:register] : finded 'OnPlayerActivationKeyRelease' callback function (index:18)



RE: Problema com sampvoice - Nexus - 15/11/2020

Alguém consegue dar uma força?


RE: Problema com sampvoice - xbruno1000x - 15/11/2020

Código PHP:
[00:42:23] : [sv:dbg:network:connect] : connecting player (1with address (x.x.x.x) ...
[
00:42:23] : [sv:dbg:network:connect] : player (1assigned key (ba083fbb7c00d27f)
[
00:42:23] : [sv:dbg:network:receive] : player (1identified (port:59050)
[
01:05:42] : [sv:dbg:network:connect] : disconnecting player (1) ... 

Quando o player conecta no servidor, isso é mostrado?
de resto, vejo tudo correto...


RE: Problema com sampvoice - Nexus - 16/11/2020

(15/11/2020 14:57)xbruno1000x Escreveu:
Código PHP:
[00:42:23] : [sv:dbg:network:connect] : connecting player (1with address (x.x.x.x) ...
[
00:42:23] : [sv:dbg:network:connect] : player (1assigned key (ba083fbb7c00d27f)
[
00:42:23] : [sv:dbg:network:receive] : player (1identified (port:59050)
[
01:05:42] : [sv:dbg:network:connect] : disconnecting player (1) ... 

Quando o player conecta no servidor, isso é mostrado?
de resto, vejo tudo correto...

Aparecem apenas essas mensagens:
Código:
[00:42:23] : [sv:dbg:network:connect] : connecting player (1) with address (x.x.x.x) ...
[00:42:23] : [sv:dbg:network:connect] : player (1) assigned key (ba083fbb7c00d27f)
[00:42:23] : [sv:dbg:network:receive] : player (1) identified (port:59050)
O jogador não é desconectado do sampvoice.


RE: Problema com sampvoice - xbruno1000x - 16/11/2020

Eu realmente não vejo nada de errado. Saiu a versão 3.1 recentemente. Tente fazer uma atualização, quem sabe funcione. Caso não dê certo, crie um issue no endereço:
https://github.com/CyberMor/sampvoice/issues


RE: Problema com sampvoice - anime107 - 06/07/2021

estou com o mesmo problema, tudo certo mas nao aparece a mensagem no canto esqurdo da tela nem o alto falante em cima do jogador.


RE: Problema com sampvoice - NelsonC. - 07/07/2021

Tente usar o sistema como filterscript