PlayAudioStreamForPlayer is not working on mine
#1

I have this command & dialog:

PHP код:
CMD:radio(playeridparams[])
{
    
ShowPlayerDialog(playerid123,DIALOG_STYLE_LIST"Trucker's Life - Radio Stations""SkyFM\nBlazin PH Radio\nRadio Off","Select","Close");
    return 
1;

and my Dialog response:
PHP код:
if(dialogid == 15151)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.pls?id=780577");
            }
            if(
listitem == 1)
            {
                
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.pls?id=213653");
            }
            if(
listitem == 2)
            {
                
StopAudioStreamForPlayer(playerid);
            }
        }
    return 
1;

Already tried to change the dialogid couple of times but still no sound...
So what have I done wrong? please help me, i'm desperate on making my own radio system, rather on downloading fs's
Reply
#2

Nice work
Reply
#3

Send a message to the player (or print) after you play the audio. Then tell us if you get the message.
Reply
#4

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Send a message to the player (or print) after you play the audio. Then tell us if you get the message.
Testing it out now, I'm just gonna edit this post for my reply

EDIT: Tried this, but still it does not play the radio

PHP код:
if(dialogid == 15151)
    {
        if(
response)
        {
            if(
listitem == 0)
            {
                
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.pls?id=780577");
                
SendClientMessage(playerid0x00FF00FF"You have tuned in to SkyFM");
            }
            if(
listitem == 1)
            {
                
PlayAudioStreamForPlayer(playerid"http://yp.shoutcast.com/sbin/tunein-station.pls?id=213653");
            }
            if(
listitem == 2)
            {
                
StopAudioStreamForPlayer(playerid);
            }
        }
    return 
1;

Reply
#5

Do you get the message?
Reply
#6

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Do you get the message?
Nope..
Reply
#7

Quote:
Originally Posted by sienal
Посмотреть сообщение
Nice work
what ? LOL why you said nice work ??
Reply
#8

Go through your other scripts and make sure you return zero at the end of all your "OnDialogResponse" callbacks.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 0;//this is what a default OnDialogResponse (when you click new) should really look like.
}
It's fine to return one if a dialog is found but you must return zero at the end if no dialogs were found. Sounds silly but try it i'll bet it works. (assuming your dialog ids are correct)

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 5)
    {
        //this is fine because a dialog was found
        return 1;
    }
    return 0;//but the final return should be zero
}
Reply
#9

i know it is late, but try this. itll help anyone who is directed to here.

pawn Код:
CMD:radio(playerid, params[])
{
    ShowPlayerDialog(playerid, 15151, DIALOG_STYLE_LIST, "Trucker's Life - Radio Stations", "SkyFM \nBlazin PH Radio \nRadio Off","Select","Close");
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 15151)
    {
        if(response == 1)
        {
            switch(listitem)
            {
                case 0:// The first item listed
                {
                    PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=780577");
                    return 1;
                }
                case 1: // The second item listed
                {
                    PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=213653");
                    return 1;
                }
                case 2: // The third item listed
                {
                    StopAudioStreamForPlayer(playerid);
                    return 1;
                }
            }
        }
    }
    return 1;
}
Reply
#10

When you're in-game, go into Audio settings and turn your 'Radio Volume' up to full. In order to hear audio streams, your radio volume must be above 0. When you have the radio volume muted, you do not hear the audio stream, and won't even see the audio stream link.

Go in-game > Press ESC > Go into Audio Settings > Increase Radio Volume.

If your radio volume is already turned up, then retry the code with the SendClientMessage and use the same dialog ids in the ShowPlayerDialog and OnDialogResponse, then tell us if you get the message.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)