SA-MP Forums Archive
My radio Filterscript isnt working anymore - 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: My radio Filterscript isnt working anymore (/showthread.php?tid=502676)



My radio Filterscript isnt working anymore - coolmark1995 - 25.03.2014

Hello so as you see I have my radio filterscript below I added more radio stations but when I compile it I get errors any way to fix this? if so how the problem is I dont see any errors where it says there are any way for it to allow the input line longer?

Код:
// Music stream fs by coolmark1995

#include <a_samp>
#include <zcmd>

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Music FS by coolmark1995");
        print("--------------------------------------\n");
        return 1;
}

CMD:radio(playerid, params[])
{
    ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_LIST, "Pick a music station", "Country108\nCountry 105 Calgary's #1 radio station\nB98 Today's Best Country\nNashville FM\nVirgin Radio Calgary 98.5\nCJAY 92 Calgary\nWorlds best country music\nClassic Rock 105\nHard rock 102\nIndie Rock\nClassic Rap\nA Beatles Tribute\nJazz Classics\nModern Blues\nClassic Motown\nHits From The 70's\nBest Of The 80's\nBest Of The 60'S\nAlternative Rock\nPop Rock\nJPOP\nNew Age\nBebop Jazz\nMellow Jazz\nThe Vibe Of Vegas\nClassic Hits 181\nThe Rock! Hard Rock\nReal Country FM\nThe Eagle Classic\nSmooth AC FM\nGood Time Oldies\nThe Office FM\nStop the music", "Choose", "Cancel");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 12345:
        {
            if(!response) return SendClientMessage(playerid, 0xFF330000, "No music selected.");
            switch(listitem)
            {
                case 0: PlayAudioStreamForPlayer(playerid, "http://tuner.country108.com/listen.pls");
                case 1: PlayAudioStreamForPlayer(playerid, "http://live.leanstream.co/CKRYFM-MP3?tunein");
                case 2: PlayAudioStreamForPlayer(playerid, "http://uplink.duplexfx.com:8018/listen.pls");
                case 3: PlayAudioStreamForPlayer(playerid, "http://server-14.stream-server.nl:8300/listen.pls");
                case 4: PlayAudioStreamForPlayer(playerid, "http://cibk-mp3.akacast.akamaistream.net/7/326/102120/v1/astral.akacast.akamaistream.net/cibk-mp3");
				case 5: PlayAudioStreamForPlayer(playerid, "http://cjay-mp3.akacast.akamaistream.net/7/741/102120/v1/astral.akacast.akamaistream.net/cjay-mp3");
				case 6: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/country.pls");
				case 7: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/classicrock.pls");
				case 8: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/hardrock.pls");
				case 9: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/indierock.pls");
				case 10: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/classicrap.pls");
				case 11: PlayAudioStreamForPlayer(playerid, "http://www.randomness-fun.cu.cc/test/SKY_FM-A_Beatles_Tribute.pls");
				case 12: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/jazzclassics.pls");
				case 13: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/modernblues.pls");
				case 14: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/classicmotown.pls");
				case 15: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/hit70s.pls");
				case 16: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/the80s.pls");
				case 17: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/hit60s.pls");
				case 18: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/altrock.pls");
				case 19: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/poprock.pls");
				case 20: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/newage.pls");
				case 21: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/bebop.pls");
				case 22: PlayAudioStreamForPlayer(playerid, "http://listen.sky.fm/public1/mellowjazz.pls");
				case 23: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-vibe&file=181-vibe.pls");
				case 24: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-greatoldies&file=181-greatoldies.pls");
				case 25: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-hardrock&file=181-hardrock.pls");
				case 26: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-realcountry&file=181-realcountry.pls");
				case 27: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-eagle&file=181-eagle.pls");
				case 28: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-smoothac&file=181-smoothac.pls");
				case 29: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-goodtime&file=181-goodtime.pls");
				case 30: PlayAudioStreamForPlayer(playerid, "http://www.181.fm/winamp.pls?station=181-office&file=181-office.pls");
				case 31: StopAudioStreamForPlayer(playerid);
            }
        }
    }
    return 1;
}
Error:

Код:
C:\Users\Mark\Desktop\sam\filterscripts\radio.pwn(15) : error 075: input line too long (after substitutions)
C:\Users\Mark\Desktop\sam\filterscripts\radio.pwn(16) : error 037: invalid string (possibly non-terminated string)
C:\Users\Mark\Desktop\sam\filterscripts\radio.pwn(16) : error 017: undefined symbol "Country108"
C:\Users\Mark\Desktop\sam\filterscripts\radio.pwn(16) : error 029: invalid expression, assumed zero
C:\Users\Mark\Desktop\sam\filterscripts\radio.pwn(16) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: My radio Filterscript isnt working anymore - Jstylezzz - 25.03.2014

The string inside the dialog is too long for one line. Using strcat you can 'split' the string in several parts and combine it into a string variable.

pawn Код:
new string[256]; //Not sure about the string size, you can decrease/increase it if needed
strcat(string, "Country108\nCountry 105 Calgary's #1 radio station\nB98 Today's Best Country\nNashville FM\nVirgin Radio Calgary 98.5\nCJAY 92 Calgary\nWorlds best country music\nClassic Rock 105\n");
strcat(string, "Hard rock 102\nIndie Rock\nClassic Rap\nA Beatles Tribute\nJazz Classics\nModern Blues\nClassic Motown\nHits From The 70's\nBest Of The 80's\nBest Of The 60'S\nAlternative Rock\nPop Rock\nJPOP\n");
strcat(string, "New Age\nBebop Jazz\nMellow Jazz\nThe Vibe Of Vegas\nClassic Hits 181\nThe Rock! Hard Rock\nReal Country FM\nThe Eagle Classic\nSmooth AC FM\nGood Time Oldies\nThe Office FM\nStop the music");
ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_LIST, "Pick a music station", string, "Choose", "Cancel");



Re: My radio Filterscript isnt working anymore - coolmark1995 - 25.03.2014

Quote:
Originally Posted by Jstylezzz
Посмотреть сообщение
The string inside the dialog is too long for one line. Using strcat you can 'split' the string in several parts and combine it into a string variable.

pawn Код:
new string[256]; //Not sure about the string size, you can decrease/increase it if needed
strcat(string, "Country108\nCountry 105 Calgary's #1 radio station\nB98 Today's Best Country\nNashville FM\nVirgin Radio Calgary 98.5\nCJAY 92 Calgary\nWorlds best country music\nClassic Rock 105\n");
strcat(string, "Hard rock 102\nIndie Rock\nClassic Rap\nA Beatles Tribute\nJazz Classics\nModern Blues\nClassic Motown\nHits From The 70's\nBest Of The 80's\nBest Of The 60'S\nAlternative Rock\nPop Rock\nJPOP\n");
strcat(string, "New Age\nBebop Jazz\nMellow Jazz\nThe Vibe Of Vegas\nClassic Hits 181\nThe Rock! Hard Rock\nReal Country FM\nThe Eagle Classic\nSmooth AC FM\nGood Time Oldies\nThe Office FM\nStop the music");
ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_LIST, "Pick a music station", string, "Choose", "Cancel");
so how would that look? like where would I add this?


Re: My radio Filterscript isnt working anymore - Jstylezzz - 25.03.2014

In the command that holds the dialog. I removed the content of the string in the dialog, and put it in the strcat functions. The whole string will be combined into the variable 'string', which as you can see, is used in the dialog to display the text.
pawn Код:
CMD:radio(playerid, params[])
{
    new string[256]; //Not sure about the string size, you can decrease/increase it if needed
    strcat(string, "Country108\nCountry 105 Calgary's #1 radio station\nB98 Today's Best Country\nNashville FM\nVirgin Radio Calgary 98.5\nCJAY 92 Calgary\nWorlds best country music\nClassic Rock 105\n");
    strcat(string, "Hard rock 102\nIndie Rock\nClassic Rap\nA Beatles Tribute\nJazz Classics\nModern Blues\nClassic Motown\nHits From The 70's\nBest Of The 80's\nBest Of The 60'S\nAlternative Rock\nPop Rock\nJPOP\n");
    strcat(string, "New Age\nBebop Jazz\nMellow Jazz\nThe Vibe Of Vegas\nClassic Hits 181\nThe Rock! Hard Rock\nReal Country FM\nThe Eagle Classic\nSmooth AC FM\nGood Time Oldies\nThe Office FM\nStop the music");
    ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_LIST, "Pick a music station", string, "Choose", "Cancel");
    return 1;
}
I hope that I clarified it a little. If not, feel free to ask


Re: My radio Filterscript isnt working anymore - coolmark1995 - 25.03.2014

Quote:
Originally Posted by Jstylezzz
Посмотреть сообщение
In the command that holds the dialog. I removed the content of the string in the dialog, and put it in the strcat functions. The whole string will be combined into the variable 'string', which as you can see, is used in the dialog to display the text.
pawn Код:
CMD:radio(playerid, params[])
{
    new string[256]; //Not sure about the string size, you can decrease/increase it if needed
    strcat(string, "Country108\nCountry 105 Calgary's #1 radio station\nB98 Today's Best Country\nNashville FM\nVirgin Radio Calgary 98.5\nCJAY 92 Calgary\nWorlds best country music\nClassic Rock 105\n");
    strcat(string, "Hard rock 102\nIndie Rock\nClassic Rap\nA Beatles Tribute\nJazz Classics\nModern Blues\nClassic Motown\nHits From The 70's\nBest Of The 80's\nBest Of The 60'S\nAlternative Rock\nPop Rock\nJPOP\n");
    strcat(string, "New Age\nBebop Jazz\nMellow Jazz\nThe Vibe Of Vegas\nClassic Hits 181\nThe Rock! Hard Rock\nReal Country FM\nThe Eagle Classic\nSmooth AC FM\nGood Time Oldies\nThe Office FM\nStop the music");
    ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_LIST, "Pick a music station", string, "Choose", "Cancel");
    return 1;
}
I hope that I clarified it a little. If not, feel free to ask
thanks for the help +rep to you okay so problem is it only shows the first 14 stations in the list


Re: My radio Filterscript isnt working anymore - Jstylezzz - 25.03.2014

Try increasing the string from 256 to 512, and see if that solves it. It might be that the string is currently too small to hold the entire text.


Re: My radio Filterscript isnt working anymore - coolmark1995 - 25.03.2014

Quote:
Originally Posted by Jstylezzz
Посмотреть сообщение
Try increasing the string from 256 to 512, and see if that solves it. It might be that the string is currently too small to hold the entire text.
my problem now is that my radio names are all mixed up with the cases :/ so like hard rock 102 plays a different stream do I really need a /n at the end of each line?


Re: My radio Filterscript isnt working anymore - Jstylezzz - 25.03.2014

Are you sure that the amount of listitems and cases is exactly the same? Because if you miss one item in the cases, it will mess up obviously.


Re: My radio Filterscript isnt working anymore - coolmark1995 - 25.03.2014

Quote:
Originally Posted by Jstylezzz
Посмотреть сообщение
Are you sure that the amount of listitems and cases is exactly the same? Because if you miss one item in the cases, it will mess up obviously.
well can you look at my list for me? I am counting more in the list then the cases and I am not sure where the problem lies


Re: My radio Filterscript isnt working anymore - Jstylezzz - 25.03.2014

Match the name from the list with the stream from the case. If they're not the same, simply remove that it from the list (watching that the rest of the list stays in the correct order). First try that yourself. If you really can't do it, I'll have a look for you ;P