[PEDIDO] AudioSreamer
#1

Eaw galera, estou com dificuldade de fazer o sistema de audio streamer exemplo:

/tocar [link] [distancia]

o player digitando isso, toca o link que ele escolheu e a distancia que o audio serб ouvido.
Reply
#2

Tu usa, STRCMP ou ZCMD com SSCANF ?
Reply
#3

strcmp
Reply
#4

Tб na mгo chefia.
pawn Код:
if(strcmp(cmdtext, "/tocar",true) == 0)
{
    new distancia, giveplayerid, playername[MAX_PLAYER_NAME];
    new Float:X, Float:Y, Float:Z;
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
        idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
        result[idx - offset] = cmdtext[idx];
        idx++;
    }
    if(!strlen(result))
    {
        SendClientMessage(playerid, -1, "Uso correto: /tocar [link] [distвncia]");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, "Uso correto: /tocar [link] [distвncia]");
        return 1;
    }
    distancia = strval(tmp);
    if(IsPlayerConnected(playerid))
    {
        SendClientMessage(playerid, -1, "* Vocк estб ouvindo mъsica");
        GetPlayerPos(playerid, X, Y, Z);
        PlayAudioStreamForPlayer(playerid, result, X, Y, Z, distancia, 1);
    }
    return 1;
}
Reply
#5

Vlw, mas tem um problema, o chat do samp nгo estб aceitando um link tгo grande hehe, se nгo for pedir muito tem como fazer em dialog? ou outra soluзгo
Reply
#6

Vo fazer pera

OBS: Sбbia que ia dar esse problema ^^
Reply
#7

Ta aк :d

pawn Код:
//Topo do Gamemode
#define DIALOG_MUSICA_LINK 5471

if(strcmp(cmdtext, "/tocar",true) == 0)
{
    ShowPlayerDialog(playerid, DIALOG_MUSICA_LINK, DIALOG_STYLE_INPUT, "Insira o Link da Mъsica", "Insira o link da mъsica que deseja tocar:", "Proseguir", "Cancelar");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_MUSICA_LINK)
    {
        if(response)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(playerid, X, Y, Z);
            PlayAudioStreamForPlayer(playerid, inputtext, X, Y, Z, 50.0, 1);
        }
    }
    return 1;
}
Reply
#8

Obrigado!!! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)