SA-MP Forums Archive
Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help. (/showthread.php?tid=318843)



Help. - Nicholas. - 16.02.2012

So yeah.

Done a lot in my script lately. Now, I am script a MP3 Player streaming into my script.

So I done everything and compiled without any errors but when I am in-game, I do /radio in the vehicle.
It brings up the dialogs and I click on the station but the music doesn't play.

Here are the codes I have.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_RADIO:
        {
            if(!response)
            {
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "INFO: You canceled the radio station");
                    return 1;
            }

            switch(listitem)
            {
                case 0:
                {
                    PlayAudioStreamForPlayer(playerid, "http://www.hot108.com/hot108live.html");
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "INFO: Your vehicle's radio is now playing.");
                }
                case 1:
                {
                    PlayAudioStreamForPlayer(playerid, "");
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "INFO: Your vehicle's radio is now playing.");

                }
                case 2:
                {
                    PlayAudioStreamForPlayer(playerid, "");
                    SendClientMessage(playerid, COLOR_BRIGHTRED, "INFO: Your vehicle's radio is now playing.");
                }

            }
        }
    }
    return 1;
}
pawn Код:
//--------------------------------[COMMANDS]------------------------------------
CMD:radio(playerid, params[])
{
         if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, -1, "You need to be in a vehicle to use this command!");
         ShowPlayerDialog(playerid, DIALOG_RADIO,DIALOG_STYLE_LIST,"Radio Stations","1. 95.3 FM\r\n2. 92.5 FM\r\n3. 101.1 FM","Select", "Cancel");
         return 1;
    }
CMD:offradio(playerid, params[])
{
        if(IsPlayerInAnyVehicle(playerid))
        StopAudioStreamForPlayer(playerid);
        return 1;
    }
Is there something wrong in the coding? Please help.


Re: Help. - Twisted_Insane - 16.02.2012

Hmm, only the first case is returning you music, right? So, are you sure that this page you requested to play your music is valid/available right now?

EDIT: Just found out you can't use "www." into the stream! Just use "http" then!

EDIT 2: Shit, 2KY was faster! ><


Re: Help. - 2KY - 16.02.2012

Do not put the www. in the station URL, it will cause it to malfunction.

pawn Код:
case d_RADIO:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0: //Alternative Rock
                    {
                        PlayAudioStreamForPlayer(playerid, "http://stream.radioactivity.fm:8002/");
                        SendClientMessage(playerid, c_GENERAL, "> You are now listening to 99.1 FM - WIKD Eagles!");
                    }
                    case 1: //Best of the 80s
                    {
                        PlayAudioStreamForPlayer(playerid, "http://scfire-mtc-aa05.stream.aol.com:80/stream/1013/");
                        SendClientMessage(playerid, c_GENERAL, "> You are now listening to SKY.FM - Best of the 80s!");
                    }
                }
                SendClientMessage(playerid, c_ERROR, "NOTE: In order to even START the stream - Your GTA radio volume has to be on!");
            }
            else return StopAudioStreamForPlayer(playerid);
        }
(Mine)


Re: Help. - Nicholas. - 16.02.2012

Thank you 2KY once again.


Re: Help. - Nicholas. - 16.02.2012

Does anyone know where I could get good online steams? I am looking for Hip/hop, Rock and country.

EDIT: I am having a problem.. I could do /radio outside of vehicles. I only want to be able to do /radio in vehicles.


Re: Help. - 2KY - 16.02.2012

pawn Код:
if(!IsPlayerInAnyVehicle(playerid)) return 0;



Re: Help. - Nicholas. - 16.02.2012

Oh yeah.
Thanks again.


Re: Help. - Nicholas. - 17.02.2012

It's kind of lame.
I've another problem.

I keep getting this error
pawn Код:
C:\Users\Toshiba\SA-MP\SA-MP Scripting\RPG\gamemodes\RPG.pwn(104) : error 017: undefined symbol "playerid"
pawn Код:
LevelPlayer[playerid] = SetTimerEx("ScoreTimer", 60000, true, "i", playerid);  < Line 104
pawn Код:
forward ScoreTimer(playerid);
public ScoreTimer(playerid)
{
      LevelPlayer[playerid]++;
      new string[50];
      format(string, sizeof(string), "INFO: You are now level up (%i).",LevelPlayer[playerid]);
      SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
      return 1;
}



Re: Help. - Nicholas. - 17.02.2012

Anyone please?


Re: Help. - iggy1 - 17.02.2012

Playerid doesn't exist in the function you are calling this code from.

pawn Код:
LevelPlayer[playerid] = SetTimerEx("ScoreTimer", 60000, true, "i", playerid);
Good streams: http://www.shoutcast.com/