Portal SAMP
[Ajuda] Sistema de VOIP - 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] Sistema de VOIP (/showthread.php?tid=268)



Sistema de VOIP - [MV]LeleziN.Dr - 02/11/2020

Bom venho em meio desse poste pede uma ajuda a vcs pois tentei de varia maneiras e não conseguir resolver esses erros.
E um sistema de Chat por Voz (VOIP) o tal conhecido.
Vou posta o Codigo e os erros.

Sistema VOIP
Código:
#include <a_samp>
#include <core>
#include <float>
#include <Pawn.CMD>
#include <sscanf2>
#include <sampvoice>

#include "../include/gl_common.inc"

main() {}

new SV_DLSTREAM:pstream[MAX_PLAYERS] = SV_NULL;

public SV_BOOL:OnPlayerVoice(
    SV_UINT:playerid,
    SV_PACKET:packet,
    SV_UINT:volume
) {


    if (pstream[playerid]) sv_send_packet(packet, pstream[playerid]);

    return SV_TRUE;

}

public OnPlayerConnect(playerid) {

    if (sv_get_version(playerid) == SV_NULL) SendClientMessage(playerid, -1, "SampVoice");
    else if (sv_get_version(playerid) < SV_VERSION) SendClientMessage(playerid, -1, "SampVoice");
    else {
        if (!sv_has_micro(playerid)) SendClientMessage(playerid, -1, "SampVoice");
        else {
            sv_set_key(playerid, 0x42);
            pstream[playerid] = sv_dlstream_create_at_player(playerid);
            SendClientMessage(playerid, -1, "SampVoice");
        }
    }

    return 1;

}

public OnPlayerDisconnect(playerid, reason) {

    if (pstream[playerid]) sv_stream_delete(pstream[playerid]);
    return 1;

}

public OnGameModeInit() {

    SetGameModeText("SampVoice: Test Server");
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
    ShowNameTags(1);
    SetNameTagDrawDistance(40.0);
    EnableStuntBonusForAll(0);
    DisableInteriorEnterExits();
    SetWeather(2);
    SetWorldTime(11);
    //AddPlayerClass(0,2495.3438,-1686.2836,13.5140,358.8068,0,0,0,0,0,0);
    //AddPlayerClass(270,2517.7124,-1661.4698,14.2494,101.8945,0,0,0,0,0,0);
    //AddPlayerClass(269,2498.7837,-1647.8068,13.5532,169.2618,0,0,0,0,0,0);
    //AddPlayerClass(107,2486.7397,-1647.0914,14.0703,185.5319,0,0,0,0,0,0);
    //AddPlayerClass(271,2465.4194,-1687.7552,13.5140,282.6660,0,0,0,0,0,0);
    //AddPlayerClass(106,2498.7837,-1647.8068,13.5532,169.2618,0,0,0,0,0,0);
    //AddPlayerClass(105,2498.7837,-1647.8068,13.5532,169.2618,0,0,0,0,0,0);
    LoadStaticVehiclesFromFile("vehicles/trains.txt");
    LoadStaticVehiclesFromFile("vehicles/pilots.txt");
    LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
    LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
    LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");
    LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
    LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
    LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");
    LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
    LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
    LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
    LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");
    LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
    LoadStaticVehiclesFromFile("vehicles/bone.txt");
    LoadStaticVehiclesFromFile("vehicles/flint.txt");
    LoadStaticVehiclesFromFile("vehicles/tierra.txt");
    LoadStaticVehiclesFromFile("vehicles/red_county.txt");

    return 1;

}


Erros:
Código:
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(12) : error 017: undefined symbol "SV_NULL"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(12) : error 008: must be a constant expression; assumed zero
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(14) : warning 235: public function lacks forward declaration (symbol "OnPlayerVoice")
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(21) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(21) : error 017: undefined symbol "sv_send_packet"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(23) : error 017: undefined symbol "SV_TRUE"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(23) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : error 017: undefined symbol "sv_get_version"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(30) : error 017: undefined symbol "sv_get_version"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(32) : error 017: undefined symbol "sv_has_micro"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(34) : error 017: undefined symbol "sv_set_key"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(35) : error 017: undefined symbol "sv_dlstream_create_at_player"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(35) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(46) : error 017: undefined symbol "sv_stream_delete"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


10 Errors.

Se poderem mim ajuda agradeço a todos.

                                                                    > Servidor em Construção <
                                             • TSVR Brasil RPG 
                                                         - Em breve -


RE: Sistema de VOIP - xbruno1000x - 02/11/2020

Instalei o plugin em meu server recentemente, e acredito que seja erro na include.
Certifique-se de ter incluído isso no seu gamemode:
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);
}
e confira se está utilizando a versão 3.0.


RE: Sistema de VOIP - [MV]LeleziN.Dr - 02/11/2020

Agora deu isso
Código:
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(22) : warning 235: public function lacks forward declaration (symbol "OnPlayerVoice")
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : error 017: undefined symbol "pstream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : warning 215: expression has no effect
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : error 001: expected token: ";", but found "]"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : error 029: invalid expression, assumed zero
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\VOIP.pwn(29) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.



RE: Sistema de VOIP - xbruno1000x - 03/11/2020

Mande a linha
Dei uma olhada no código antigo que você havia postado, e você esqueceu de remover os resquícios do código antigo...não existe mais a public OnPlayerVoice, e nem a variavel pstream. Use apenas o que eu havia te mandado acima...


RE: Sistema de VOIP - [MV]LeleziN.Dr - 03/11/2020

Bom fiz igual o que vc mim mandou e deu esses seguintes erros.

Código:
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(15) : error 017: undefined symbol "SV_NULL"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(15) : error 008: must be a constant expression; assumed zero
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(16) : error 017: undefined symbol "SV_NULL"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(24) : warning 235: public function lacks forward declaration (symbol "OnPlayerActivationKeyPress")
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(27) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(27) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(27) : error 017: undefined symbol "SvAttachSpeakerToStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(29) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(29) : error 017: undefined symbol "SvAttachSpeakerToStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(32) : warning 235: public function lacks forward declaration (symbol "OnPlayerActivationKeyRelease")
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(35) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(35) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(35) : error 017: undefined symbol "SvDetachSpeakerFromStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(37) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(37) : error 017: undefined symbol "SvDetachSpeakerFromStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(43) : error 017: undefined symbol "SvGetVersion"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(48) : error 017: undefined symbol "SvHasMicro"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(54) : warning 211: possibly unintended assignment
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(54) : error 017: undefined symbol "SvCreateDLStreamAtPlayer"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(59) : error 017: undefined symbol "SvAttachListenerToStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(62) : error 017: undefined symbol "SvAddKey"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(63) : error 017: undefined symbol "SvAddKey"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(65) : warning 209: function "SSCANF_OnPlayerConnect" should return a value
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(72) : error 017: undefined symbol "SvDeleteStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(73) : error 017: undefined symbol "SV_NULL"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(73) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(75) : warning 209: function "SSCANF_OnPlayerDisconnect" should return a value
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(82) : error 017: undefined symbol "SvCreateGStream"
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(82) : warning 213: tag mismatch
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(83) : warning 209: function "SSCANF_OnGameModeInit" should return a value
C:\Users\usuario\Desktop\TSVR Brasil\filterscripts\Test.pwn(87) : error 017: undefined symbol "SvDeleteStream"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


17 Errors.



RE: Sistema de VOIP - Marcos_Owner - 18/03/2021

Usar como Fs que funcionar!