Lenny

Radio dialog

Dec 2nd, 2011
973
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.19 KB | None | 0 0
  1. ////
  2. //              RADIO DIALOG v1.0
  3. //                  by Lenny
  4. ////
  5.  
  6. // CONFIGURATION
  7. //
  8.  
  9. #define FILTERSCRIPT
  10.  
  11. #define DIALOG_RADIO_CATEGORIES     6345        // Radio categories
  12. #define DIALOG_RADIO_STATIONS       6346        // Radio stations
  13.  
  14. #define MAX_ST_TYPE 31
  15. #define MAX_ST_NAME 30
  16. #define MAX_ST_URL  130
  17.  
  18. enum e_Audio_Stations
  19. {
  20.     st_name[MAX_ST_NAME],
  21.     st_type[MAX_ST_TYPE],
  22.     st_url[MAX_ST_URL]
  23. };
  24.  
  25. new Audio_Stations[][e_Audio_Stations] =
  26. {
  27.     // STATION NAME     // CATEGORY         // URL
  28.     { "Turn radio off", "{AA3333}Turn radio off{FFFFFF}", "Turn radio off" }, // Leave this one in to allow disabling the radio
  29.     { "UK Top 40", "Pop", "http://www.181.fm/winamp.pls?station=181-uktop40&style=mp3&description=UK%20top%2040&file=181-uktop40.pls" },
  30.     { "The Rock!", "Rock", "http://www.181.fm/winamp.pls?station=181-hardrock&style=&description=The%20Rock!%20(Hard%20Rock)&file=181-hardrock.pls" },
  31.     { "Soul 181.fm", "Soul", "http://www.181.fm/winamp.pls?station=181-soul&style=mp3&description=Soul&file=181-soul.pls" },
  32.     { "Classic Hits", "Classic Hits", "http://www.181.fm/winamp.pls?station=181-greatoldies&style=mp3&description=Classic%20Hits%20181&file=181-greatoldies.pls" },
  33.     { "Super 70's", "Decades", "http://www.181.fm/winamp.pls?station=181-70s&style=mp3&description=Super%2070s&file=181-70s.pls" },
  34.     { "Awesome 80's", "Decades", "http://www.181.fm/winamp.pls?station=181-awesome80s&style=&description=Awesome%2080's&file=181-awesome80s.pls" },
  35.     { "Lite 80's", "Decades", "http://www.181.fm/winamp.pls?station=181-lite80s&style=&description=Lite%2080's&file=181-lite80s.pls" },
  36.     { "Star 90's", "Decades", "http://www.181.fm/winamp.pls?station=181-star90s&style=&description=Star%2090's&file=181-star90s.pls" },
  37.     { "Lite 90's", "Decades", "http://www.181.fm/winamp.pls?station=181-90scountry&style=&description=90's%20Country&file=181-90scountry.pls" },
  38.     { "90's Alternative", "Decades", "http://www.181.fm/winamp.pls?station=181-90salt&style=&description=90's%20Alternative&file=181-90salt.pls" },
  39.     { "Power 181 (Top 40)", "Pop", "http://www.181.fm/winamp.pls?station=181-power&style=mp3&description=Power%20181%20(Top%2040)&file=181-power.pls" },
  40.     { "Old School HipHop/RnB", "Pop", "http://www.181.fm/winamp.pls?station=181-oldschool&style=mp3&description=Old%20School%20HipHop/RnB&file=181-oldschool.pls" },
  41.     { "Party 181", "Pop", "http://www.181.fm/winamp.pls?station=181-party&style=&description=Party%20181&file=181-party.pls" },
  42.     { "The mix", "Pop", "http://www.181.fm/winamp.pls?station=181-themix&style=&description=The%20Mix&file=181-themix.pls" },
  43.     { "The Buzz (Alt. Rock)", "Rock", "http://www.181.fm/winamp.pls?station=181-buzz&style=mp3&description=The%20Buzz%20(Alt.%20Rock)&file=181-buzz.pls" },
  44.     { "Rock 181", "Rock", "http://www.181.fm/winamp.pls?station=181-rock&style=&description=Rock%20181&file=181-rock.pls" },
  45.     { "The Eagle (Classic)", "Rock", "http://www.181.fm/winamp.pls?station=181-eagle&style=&description=The%20Eagle%20(Classic)&file=181-eagle.pls" },
  46.     { "The Point", "Rock", "http://www.181.fm/winamp.pls?station=181-thepoint&style=&description=The%20Point&file=181-thepoint.pls" },
  47.     { "Kickin' Country", "Country", "http://www.181.fm/winamp.pls?station=181-kickincountry&style=mp3&description=Kickin'%20Country&file=181-kickincountry.pls" },
  48.     { "Highway 181", "Country", "http://www.181.fm/winamp.pls?station=181-highway&style=&description=Highway%20181&file=181-highway.pls" },
  49.     { "Real Country", "Country", "http://www.181.fm/winamp.pls?station=181-realcountry&style=&description=Real%20Country&file=181-realcountry.pls" },
  50.     { "US 181", "Country", "http://www.181.fm/winamp.pls?station=181-us181&style=&description=US%20181&file=181-us181.pls" },
  51.     { "The Beat", "HipHop/R&B", "http://www.181.fm/winamp.pls?station=181-beat&style=&description=The%20Beat%20(HipHop/R&B)&file=181-beat.pls" },
  52.     { "Old School HipHop/RnB", "HipHop/R&B", "http://www.181.fm/winamp.pls?station=181-oldschool&style=mp3&description=Old%20School%20HipHop/RnB&file=181-oldschool.pls" },
  53.     { "True R&B", "HipHop/R&B", "http://www.181.fm/winamp.pls?station=181-rnb&style=&description=True%20R&B&file=181-rnb.pls" },
  54.     { "The Box (Urban)", "HipHop/R&B", "http://www.181.fm/winamp.pls?station=181-thebox&style=&description=The%20Box%20(Urban)&file=181-thebox.pls" },
  55.     { "Jammin 181", "HipHop/R&B", "http://www.181.fm/winamp.pls?station=181-jammin&style=&description=Jammin%20181&file=181-jammin.pls" },
  56.     { "Energy 98", "Dance/Techno", "http://www.181.fm/winamp.pls?station=181-energy98&style=mp3&description=Energy%2098&file=181-energy98.pls" },
  57.     { "Energy 93 (Euro Dance)", "Dance/Techno", "http://www.181.fm/winamp.pls?station=181-energy93&style=&description=Energy%2093%20(Euro%20Dance)&file=181-energy93.pls" },
  58.     { "Chilled Out", "Dance/Techno", "http://www.181.fm/winamp.pls?station=181-chilled&style=mp3&description=Chilled%20Out&file=181-chilled.pls" },
  59.     { "Reggae Roots", "Latin/Tropical", "http://www.181.fm/winamp.pls?station=181-reggae&style=&description=Reggae%20Roots&file=181-reggae.pls" },
  60.     { "Salsa", "Latin/Tropical", "http://www.181.fm/winamp.pls?station=181-salsa&style=&description=Salsa&file=181-salsa.pls" },
  61.     { "Comedy Club", "Talk Radio", "http://www.181.fm/winamp.pls?station=181-comedy&style=&description=Comedy%20Club&file=181-comedy.pls" },
  62.     { "Business Talk Radio", "Talk Radio", "http://www.181.fm/winamp.pls?station=181-businesstalk&style=mp3&description=Business%20Talk%20Radio&file=181-businesstalk.pls" },
  63.     { "Lifestyle Talk Radio", "Talk Radio", "http://www.181.fm/winamp.pls?station=181-lifestyletalk&style=mp3&description=Lifestyle%20Talk%20Radio&file=181-lifestyletalk.pls" },
  64.     { "Christmas Power", "Christmas", "http://www.181.fm/winamp.pls?station=181-xpower&style=&description=Christmas%20Power&file=181-xpower.pls" },
  65.     { "Christmas R&B", "Christmas", "http://www.181.fm/winamp.pls?station=181-xtrue&style=&description=Christmas%20R&B&file=181-xtrue.pls" },
  66.     { "Christmas Rock", "Christmas", "http://www.181.fm/winamp.pls?station=181-xrock&style=&description=Christmas%20Rock&file=181-xrock.pls" },
  67.     { "Christmas Mix", "Christmas", "http://www.181.fm/winamp.pls?station=181-xmix&style=&description=Christmas%20Mix&file=181-xmix.pls" },
  68.     { "Christmas Smooth Jazz", "Christmas", "http://www.181.fm/winamp.pls?station=181-xsmooth&style=&description=Christmas%20Smooth%20Jazz&file=181-xsmooth.pls" }
  69. };
  70.  
  71. //
  72. // CONFIGURATION END
  73.  
  74. #include <a_samp>
  75. #include <zcmd>
  76.  
  77. #define COLOR_GREEN 0x33AA33AA
  78.  
  79. CMD:radiostations(playerid, params[])
  80. {
  81.     new
  82.         szRadioCategories[500];
  83.        
  84.     for(new i; i < sizeof(Audio_Stations); i++)
  85.     {
  86.         if(strfind(szRadioCategories, Audio_Stations[i][st_type], true) != -1)
  87.             continue;
  88.        
  89.         format(szRadioCategories, sizeof(szRadioCategories), "%s%s\n", szRadioCategories, Audio_Stations[i][st_type]);
  90.     }
  91.    
  92.     ShowPlayerDialog(playerid, DIALOG_RADIO_CATEGORIES, DIALOG_STYLE_LIST, "Radio categories", szRadioCategories, "Select", "Close");
  93.  
  94.     return 1;
  95. }
  96.  
  97. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  98. {  
  99.     if(dialogid == DIALOG_RADIO_CATEGORIES)
  100.     {
  101.         if(!response)
  102.             return 0;
  103.            
  104.         if(!strcmp(inputtext, "Turn radio off"))
  105.         {
  106.             StopAudioStreamForPlayer(playerid);
  107.             SendClientMessage(playerid, COLOR_GREEN, "Radio turned off.");
  108.             return 1;
  109.         }
  110.        
  111.         new
  112.             szRadioStations[250];
  113.            
  114.         for(new i; i < sizeof(Audio_Stations); i++)
  115.         {          
  116.             if(strfind(inputtext, Audio_Stations[i][st_type], true) == -1)
  117.                 continue;
  118.  
  119.             format(szRadioStations, sizeof(szRadioStations), "%s%s\n", szRadioStations, Audio_Stations[i][st_name]);
  120.         }
  121.        
  122.         ShowPlayerDialog(playerid, DIALOG_RADIO_STATIONS, DIALOG_STYLE_LIST, "Radio stations", szRadioStations, "Tune in", "Close");
  123.         return 1;
  124.     }
  125.    
  126.     if(dialogid == DIALOG_RADIO_STATIONS)
  127.     {
  128.         if(!response)
  129.             return 0;
  130.            
  131.         for(new i; i < sizeof(Audio_Stations); i++)
  132.         {          
  133.             if(strfind(inputtext, Audio_Stations[i][st_name], true) == -1)
  134.                 continue;
  135.  
  136.             StopAudioStreamForPlayer(playerid);
  137.            
  138.             PlayAudioStreamForPlayer(playerid, Audio_Stations[i][st_url]);
  139.            
  140.             new
  141.                 szString[22 + MAX_ST_NAME];
  142.                
  143.             format(szString, sizeof(szString), "Tuned in to station: %s", Audio_Stations[i][st_name]);
  144.             SendClientMessage(playerid, COLOR_GREEN, szString);
  145.            
  146.             cmd_radiostations(playerid, "");
  147.            
  148.             return 1;
  149.         }
  150.     }
  151.    
  152.     return 1;
  153. }
  154.  
Advertisement
Add Comment
Please, Sign In to add comment