[ajuda] musica nao reproduz
#1

Tentei fazer um sistema aqui pra reproduzir musicas ambientais, mas nao funcionou , a musica nгo toca, e quando tocar, fica travando mto.
e como q faz pra tipo, se o player digitar /sb on, se ele tentar digitar de novo, enviar mensagem: Som ambiental ja estб ativado!

Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA

native PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
native StopAudioStreamForPlayer(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{
  if (strcmp("/sb", cmdtext, true, 10) == 0)
  {
    SendClientMessage(playerid, COLOR_WHITE, "[USO] /sb on - Ativa os Sons Ambientais");
    SendClientMessage(playerid, COLOR_WHITE,       "/sb off - Desativa os Sons Ambientais");
    
    return 1;
  }
 
  if (strcmp("/sb on", cmdtext, true, 10) == 0)
  {
     SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
     PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
     return 1;
  }
   
  if (strcmp("/sb off", cmdtext, true, 10) == 0)
  {
     SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
     StopAudioStreamForPlayer(playerid);
     return 1;
  }
   
  return 1;
}
Reply
#2

и porque vocк colou para tocar apenas se o jogador estiver em uma certa coordenada, essa: 2075.5352 , 1306.7965, 10.6719, para tocar em qualquer lugar use assim

pawn Код:
PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3");
Reply
#3

pawn Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA

public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx;
    new cmd[128];
    new tmp[128];
    cmd = strtok(cmdtext, idx);
//---------------- COMANDOS ----------------//
    if(strcmp("/sb", cmdtext, true, 10) == 0)
    {
        new statusamb[4];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb on - Ativa os Sons Ambientais.");
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb off - Desativa os Sons Ambientais.");
            return 1;
        }
        statusamb = strval(tmp);
        if(strcmp(statusamb, "on", true) == 0)
        {
            SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
            PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
        }
        if(strcmp(statusamb, "off", true) == 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
            StopAudioStreamForPlayer(playerid);
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_WHITE, "[BSL] - Comando Inexistente");
}
Fiz a retirada das "natives" pois elas jб existem nas do sa-mp atual.
Reply
#4

Topo do GM:
pawn Код:
new Musica[MAX_PLAYERS];
public OnPlayerCommandText:
pawn Код:
if(strcmp("/sb", cmdtext, true, 10) == 0)
    {
        new statusamb[4];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb on - Ativa os Sons Ambientais.");
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb off - Desativa os Sons Ambientais.");
            return 1;
        }
        if(strcmp(statusamb, "on", true) == 0)
        {
            if(Musica[playerid] == 1)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Ativado");
                return 1;
            }
            Musica[playerid] = 1;
            SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
            PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
        }
        if(strcmp(statusamb, "off", true) == 0)
        {
            if(Musica[playerid] == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Desativado");
                return 1;
            }
            Musica[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
            StopAudioStreamForPlayer(playerid);
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_WHITE, "[BSL] - Comando Inexistente");
}
Reply
#5

Quote:
Originally Posted by ApeloForum
Посмотреть сообщение
Topo do GM:
pawn Код:
new Musica[MAX_PLAYERS];
public OnPlayerCommandText:
pawn Код:
if(strcmp("/sb", cmdtext, true, 10) == 0)
    {
        new statusamb[4];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb on - Ativa os Sons Ambientais.");
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb off - Desativa os Sons Ambientais.");
            return 1;
        }
        if(strcmp(statusamb, "on", true) == 0)
        {
            if(Musica[playerid] == 1)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Ativado");
                return 1;
            }
            Musica[playerid] = 1;
            SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
            PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
        }
        if(strcmp(statusamb, "off", true) == 0)
        {
            if(Musica[playerid] == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Desativado");
                return 1;
            }
            Musica[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
            StopAudioStreamForPlayer(playerid);
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_WHITE, "[BSL] - Comando Inexistente");
}
CTRL C + CTRL V, oque vocк adicionou ainda adicionou incorreto, deveria usar bool.
Reply
#6

Quote:
Originally Posted by GraziFerreira
Посмотреть сообщение
CTRL C + CTRL V, oque vocк adicionou ainda adicionou incorreto, deveria usar bool.
Se nгo sabe nгo fala --' Eu poderia usar bool mas nгo quero, seria disperdicio de cйlula, sem falar que no seu CODE nгo a nada que ele pediu, vocк sу retirou native's (uauuu ela й uma genia), e vem falar do meu CODE, se vocк nгo sabe eu Compilei e Testei
Reply
#7

Grazi, o seu apresentou alguns erros a mais do que o Do apelo, eu coloquei a native , pq deu menos erros, sobrando apenas 3.
ficou assim

Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA

new Musica[MAX_PLAYERS];

native PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
native StopAudioStreamForPlayer(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{

  if(strcmp("/sb", cmdtext, true, 10) == 0)
    {
        new statusamb[4];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb on - Ativa os Sons Ambientais.");
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb off - Desativa os Sons Ambientais.");
            return 1;
        }
        if(strcmp(statusamb, "on", true) == 0)
        {
            if(Musica[playerid] == 1)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Ativado");
                return 1;
            }
            Musica[playerid] = 1;
            SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
            PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
        }
        if(strcmp(statusamb, "off", true) == 0)
        {
            if(Musica[playerid] == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Desativado");
                return 1;
            }
            Musica[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
            StopAudioStreamForPlayer(playerid);
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_WHITE, "[BSL] - Comando Inexistente");
}
Linhas do Erro:
Код:
C:\Users\User4\Desktop\acesorios.pwn(15) : error 017: undefined symbol "tmp"
C:\Users\User4\Desktop\acesorios.pwn(15) : error 017: undefined symbol "strtok"
C:\Users\User4\Desktop\acesorios.pwn(16) : error 017: undefined symbol "tmp"
Acho que estб faltando alguma include, obrigado os 2, + REP !
Reply
#8

Perdгo, aqui estб:
pawn Код:
#include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA

new Musica[MAX_PLAYERS];

native PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0);
native StopAudioStreamForPlayer(playerid);

public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx;
    new cmd[128];
    new tmp[128];
    cmd = strtok(cmdtext, idx);
    if(strcmp("/sb", cmdtext, true, 10) == 0)
    {
        new statusamb[4];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb on - Ativa os Sons Ambientais.");
            SendClientMessage(playerid, COLOR_WHITE, "Uso correto: /sb off - Desativa os Sons Ambientais.");
            return 1;
        }
        if(strcmp(statusamb, "on", true) == 0)
        {
            if(Musica[playerid] == 1)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Ativado");
                return 1;
            }
            Musica[playerid] = 1;
            SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental Ativado");
            PlayAudioStreamForPlayer(playerid, "http://dc404.4shared.com/img/130907008/f91252f3/dlink__2Fdownload_2FZ1mWznVu_3Ftsid_3D20120304-182917-ef307e76/preview.mp3", 2075.5352 , 1306.7965, 10.6719, 50.0, 1);
        }
        if(strcmp(statusamb, "off", true) == 0)
        {
            if(Musica[playerid] == 0)
            {
                SendClientMessage(playerid,COLOR_WHITE, "[BSL] Som Ambiental jб esб Desativado");
                return 1;
            }
            Musica[playerid] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "[BSL] Som Ambiental Desativado");
            StopAudioStreamForPlayer(playerid);
        }
        return 1;
    }
    return SendClientMessage(playerid, COLOR_WHITE, "[BSL] - Comando Inexistente");
}
Reply
#9

Quote:
Originally Posted by ApeloForum
Посмотреть сообщение
Se nгo sabe nгo fala --' Eu poderia usar bool mas nгo quero, seria disperdicio de cйlula, sem falar que no seu CODE nгo a nada que ele pediu, vocк sу retirou native's (uauuu ela й uma genia), e vem falar do meu CODE, se vocк nгo sabe eu Compilei e Testei
Aprenda a codar para vim discutir comigo, vocк usar 1 valor para uma variavel ao invez de usar bool, isso sim й desperdicio pergunte a todos aк ! E nem ajudou que ele me reputou , nгo sou gкnia simplesmente falo oque tenho devido conhecimento. Claro que vai compilar mais nгo usar bool й um desperdicio inъtil !
Reply
#10

Quote:
Originally Posted by GraziFerreira
Посмотреть сообщение
Aprenda a codar para vim discutir comigo, vocк usar 1 valor para uma variavel ao invez de usar bool, isso sim й desperdicio pergunte a todos aк ! E nem ajudou que ele me reputou , nгo sou gкnia simplesmente falo oque tenho devido conhecimento. Claro que vai compilar mais nгo usar bool й um desperdicio inъtil !
bool Vocк usa se quiser --' Eu nгo uso, compila correto e consigo jogar tranquilamente '-'
Veja:
https://sampforum.blast.hk/showthread.php?tid=292185

Mas se ele usa-se este CODE mais de uma vez? Por exemplo, para bloquear esse 2 Comandos? Iai? bool Nгo iria dar contas pois so pode ser true ou false (0 ou 1)...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)