Problem with PlayAudioStreamForPlayer
#1

I made that when a player uses the command / Music, DIALOG_STYLE_INPUT him out, and bring the link of a song. There are no eror but the problem is that it will not load link of the song.
I do not know what the problem.

pawn Код:
if(strcmp(cmd, "/muzika", true) ==0)
    {
        ShowPlayerDialog(playerid, 125, DIALOG_STYLE_INPUT, "Muzika", "Unesite link pesme.", "Pusti", "Otkazi" );
        return 1;
    }
pawn Код:
if(dialogid == 125)
        {
            if(strlen(inputtext))
            {
                new linkbre;
                linkbre = strval(inputtext);
                new link[128];
                format(link, sizeof(link), "%s",linkbre);
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(IsPlayerInRangeOfPoint(i, 50 , X, Y, Z))
                        {
                            PlayAudioStreamForPlayer(i, link, X, Y, Z, 50, 1);
                            return 1;
                        }
                        return 1;
                    }
                }
            }
        }
Reply
#2

Try this one brother. I Guess i got the mistake you did.

pawn Код:
if(dialogid == 125)
        {
            if(strlen(inputtext))
            {
                new linkbre[128];
                linkbre = strval(inputtext);
                new link[128];
                format(link, sizeof(link), "%s",linkbre);
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(IsPlayerInRangeOfPoint(i, 50 , X, Y, Z))
                        {
                            PlayAudioStreamForPlayer(i, link, X, Y, Z, 50, 1);
                            return 1;
                        }
                        return 1;
                    }
                }
            }
        }
Reply
#3

Why are you using strval on inputtext..?

Get rid of all the string shit and just do

PlayAudioStreamForPlayer(i, inputtext, X, Y, Z, 50, 1);

and remove the return under PlayAudioStreamForPlayer because that's going to stop your loop as soon as it finds a player in range.
Reply
#4

Now i have eror...
Код:
C:\Users\xp\Desktop\BlizZard RP 0.3d\gamemodes\BlizZard.pwn(19717) : error 033: array must be indexed (variable "linkbre")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

Quote:
Originally Posted by MP2
Посмотреть сообщение
Why are you using strval on inputtext..?

Get rid of all the string shit and just do

PlayAudioStreamForPlayer(i, inputtext, X, Y, Z, 50, 1);
Hell yeah Damn my bad too MP2 Ty for this bruh.

Here's the code lil bruh. Try this one

pawn Код:
if(dialogid == 125)
        {
            if(strlen(inputtext))
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i))
                    {
                        if(IsPlayerInRangeOfPoint(i, 50 , X, Y, Z))
                        {
                            PlayAudioStreamForPlayer(i, inputtext, X, Y, Z, 50, 1);
                            return 1;
                        }
                        return 1;
                    }
                }
            }
        }
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
Get rid of all the string shit
^^^^

Do I have to do it for you? (not going to, going to bed.)
Reply
#7

Quote:
Originally Posted by MP2
Посмотреть сообщение
^^^^

Do I have to do it for you? (not going to, going to bed.)
I've already done that. He needs to check my post above.
Reply
#8

Thank you very much ... I do not know what I looking when I was making ... xD
Reply
#9

Make sure you remove the return from inside the loop.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)