S4T3K

Radios

Mar 26th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.72 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #pragma tabsize 0
  4. #define DIALOG_RADIOS 11748 // Nombre au hasard, si déjà pris, changez le par un nombre pas encore pris
  5. #define DIALOG_NRJ 11784 // Idem
  6. #define DIALOG_PERSO 11785
  7.  
  8.  
  9. new bool:RadioON[MAX_PLAYERS] = false, phrase[512];
  10.  
  11. public OnPlayerCommandText(playerid, cmdtext[])
  12. {
  13.     format(phrase, sizeof(phrase), "Skyrock\nNRJ\nFun Radio\nVirgin Radio\nRadio personnalisée");
  14.     if (strcmp("/radio", cmdtext, true, 6) == 0)
  15.     {
  16.         ShowPlayerDialog(playerid, DIALOG_RADIOS, DIALOG_STYLE_LIST, "Radios", phrase, "Mettre", "Quitter");
  17.         return 1;
  18.     }
  19.     if(strcmp("/stopradio", cmdtext, true, 10) == 0)
  20.     {
  21.         if(RadioON[playerid] == true)
  22.         {
  23.             StopAudioStreamForPlayer(playerid);
  24.             SendClientMessage(playerid, -1, "{336699}[Information]{FFFFFF} Vous avez arrêté la radio.");
  25.             RadioON[playerid] = false;
  26.         }
  27.         else
  28.         {
  29.             SendClientMessage(playerid, -1, "{FF0000}[Erreur]{FFFFFF} Vous ne pouvez pas arrêter la radio si vous ne l'écoutez pas !");
  30.         }
  31.     return 1;
  32.     }
  33. return 0;
  34. }
  35.  
  36. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  37. {
  38.     if(dialogid == DIALOG_RADIOS)
  39.     {
  40.         if(!response)
  41.         {
  42.             ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, "Fermer", "Fermer le dialog", "Ok", "Ok");
  43.         }
  44.         else
  45.         {
  46.             if(listitem == 0)
  47.             {
  48.                 StopAudioStreamForPlayer(playerid);
  49.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj/all/nrj_113225.mp3");
  50.                 SendClientMessage(playerid, -1, "{9ACD32}[Information]{FFFFFF} Vous écoutez maintenant Skyrock.");
  51.                 RadioON[playerid] = true;
  52.             }
  53.             if(listitem == 1)
  54.             {
  55.                 new str[512];
  56.                 format(str,sizeof(str),"NRJ Normal\nNRJ by Disney\nNRJ Club\nNRJ Dance\nNRJ French\nNRJ Friendly\nNRJ Girl\nNRJ Hits\nNRJ Ibiza\nNRJ In Bed\n NRJ iTunes\nNRJ Spécial Lady Gaga\nNRJ Lounge\nNRJ Master Mix\nNRJ Spécial Mickael Jackson\nNRJ New York\nNRJ Next");
  57.                 strcat(str,"\nNRJ Nouveautés\nNRJ Party\nNRJ Pop\nNRJ Rap FR\nNRJ Rap US\nNRJ Spécial Rihanna\nNRJ RnB\nNRJ Rock\nNRJ Running\nNRJ Spécial Shakira\nNRJ Shop\nNRJ Sun\nNRJ Spécial Black Eyed Peas\nNRJ Spécial Usher");
  58.                 ShowPlayerDialog(playerid, DIALOG_NRJ, DIALOG_STYLE_LIST, "NRJ", str, "Jouer", "Retour");
  59.             }
  60.             if(listitem == 2)
  61.             {
  62.                 StopAudioStreamForPlayer(playerid);
  63.                 PlayAudioStreamForPlayer(playerid, "http://icecast.funradio.fr/fun-1-44-128.m3u");
  64.                 SendClientMessage(playerid, -1, "{9ACD32}[Information]{FFFFFF} Vous écoutez maintenant Fun Radio !");
  65.                 RadioON[playerid] = true;
  66.             }
  67.             if(listitem == 3)
  68.             {
  69.                 StopAudioStreamForPlayer(playerid);
  70.                 PlayAudioStreamForPlayer(playerid, "http://stream5.nrj.yacast.net/virginradio.m3u");
  71.                 SendClientMessage(playerid, -1, "{9ACD32}[Information]{FFFFFF} Vous écoutez maintenant Virgin Radio !");
  72.                 RadioON[playerid] = true;
  73.             }
  74.             if(listitem == 4)
  75.             {
  76.                 ShowPlayerDialog(playerid, DIALOG_PERSO, DIALOG_STYLE_INPUT, "Radio personnalisée", "Entrez ci-dessous l'url de votre radio.\nElle doit se terminer par {727A7D}.mp3, .m3u, .ogg, .vbs, {FFFFFF}etc.", "Jouer", "Retour");
  77.             }
  78.         }
  79.     return 1;
  80.     }
  81.    
  82.    
  83.     if(dialogid == DIALOG_NRJ)
  84.     {
  85.         if(!response)
  86.         {
  87.             ShowPlayerDialog(playerid, DIALOG_RADIOS, DIALOG_STYLE_LIST, "Radios", phrase, "Mettre", "Quitter");
  88.         }
  89.         else
  90.         {
  91.             if(listitem == 0)
  92.             {
  93.                 StopAudioStreamForPlayer(playerid);
  94.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj/all/nrj_113225.mp3");
  95.                 RadioON[playerid] = true;
  96.             }
  97.             if(listitem == 1)
  98.             {
  99.                 StopAudioStreamForPlayer(playerid);
  100.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_by_disney/all/nrj_152411.mp3");
  101.                 RadioON[playerid] = true;
  102.             }
  103.             if(listitem == 2)
  104.             {
  105.                 StopAudioStreamForPlayer(playerid);
  106.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_clubbin/all/nrj_153250.mp3");
  107.                 RadioON[playerid] = true;
  108.             }
  109.             if(listitem == 3)
  110.             {
  111.                 StopAudioStreamForPlayer(playerid);
  112.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_dance/all/nrj_151505.mp3");
  113.                 RadioON[playerid] = true;
  114.             }
  115.             if(listitem == 4)
  116.             {
  117.                 StopAudioStreamForPlayer(playerid);
  118.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_french/all/nrj_155913.mp3");
  119.                 RadioON[playerid] = true;
  120.             }
  121.             if(listitem == 5)
  122.             {
  123.                 StopAudioStreamForPlayer(playerid);
  124.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_friendly/all/nrj_164207.mp3");
  125.                 RadioON[playerid] = true;
  126.             }
  127.             if(listitem == 6)
  128.             {
  129.                 StopAudioStreamForPlayer(playerid);
  130.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_girl/all/nrj_153716.mp3");
  131.                 RadioON[playerid] = true;
  132.             }
  133.             if(listitem == 7)
  134.             {
  135.                 StopAudioStreamForPlayer(playerid);
  136.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_hits/all/nrj_150726.mp3");
  137.                 RadioON[playerid] = true;
  138.             }
  139.             if(listitem == 8)
  140.             {
  141.                 StopAudioStreamForPlayer(playerid);
  142.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_ibiza/all/nrj_164849.mp3");
  143.                 RadioON[playerid] = true;
  144.             }
  145.             if(listitem == 9)
  146.             {
  147.                 StopAudioStreamForPlayer(playerid);
  148.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_in_bed/all/nrj_135650.mp3");
  149.                 RadioON[playerid] = true;
  150.             }
  151.             if(listitem == 10)
  152.             {
  153.                 StopAudioStreamForPlayer(playerid);
  154.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_itunes/all/nrj_153938.mp3");
  155.                 RadioON[playerid] = true;
  156.             }
  157.             if(listitem == 11)
  158.             {
  159.                 StopAudioStreamForPlayer(playerid);
  160.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_lady_gaga/all/nrj_152704.mp3");
  161.                 RadioON[playerid] = true;
  162.             }
  163.             if(listitem == 12)
  164.             {
  165.                 StopAudioStreamForPlayer(playerid);
  166.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_lounge/all/nrj_151750.mp3");
  167.                 RadioON[playerid] = true;
  168.             }
  169.             if(listitem == 13)
  170.             {
  171.                 StopAudioStreamForPlayer(playerid);
  172.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_mastermix/all/nrj_163522.mp3");
  173.                 RadioON[playerid] = true;
  174.             }
  175.             if(listitem == 14)
  176.             {
  177.                 StopAudioStreamForPlayer(playerid);
  178.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_michael_jackson/all/nrj_154634.mp3");
  179.                 RadioON[playerid] = true;
  180.             }
  181.             if(listitem == 15)
  182.             {
  183.                 StopAudioStreamForPlayer(playerid);
  184.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_new-york/all/nrj_140527.mp3");
  185.                 RadioON[playerid] = true;
  186.             }
  187.             if(listitem == 16)
  188.             {
  189.                 StopAudioStreamForPlayer(playerid);
  190.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_next/all/nrj_122336.mp3");
  191.                 RadioON[playerid] = true;
  192.             }
  193.             if(listitem == 17)
  194.             {
  195.                 StopAudioStreamForPlayer(playerid);
  196.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_nouveaute/all/nrj_161209.mp3");
  197.                 RadioON[playerid] = true;
  198.             }
  199.             if(listitem == 18)
  200.             {
  201.                 StopAudioStreamForPlayer(playerid);
  202.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/2051/nrj_party/nrj_190407.mp3");
  203.                 RadioON[playerid] = true;
  204.             }
  205.             if(listitem == 19)
  206.             {
  207.                 StopAudioStreamForPlayer(playerid);
  208.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_pop/all/nrj_151240.mp3");
  209.                 RadioON[playerid] = true;
  210.             }
  211.             if(listitem == 20)
  212.             {
  213.                 StopAudioStreamForPlayer(playerid);
  214.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_rap_fr/all/nrj_145338.mp3");
  215.                 RadioON[playerid] = true;
  216.             }
  217.             if(listitem == 21)
  218.             {
  219.                 StopAudioStreamForPlayer(playerid);
  220.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_rap_us/all/nrj_144854.mp3");
  221.                 RadioON[playerid] = true;
  222.             }
  223.             if(listitem == 22)
  224.             {
  225.                 StopAudioStreamForPlayer(playerid);
  226.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_rihanna/all/nrj_163955.mp3");
  227.                 RadioON[playerid] = true;
  228.             }
  229.             if(listitem == 23)
  230.             {
  231.                 StopAudioStreamForPlayer(playerid);
  232.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_rnb/all/nrj_151038.mp3");
  233.                 RadioON[playerid] = true;
  234.             }
  235.             if(listitem == 24)
  236.             {
  237.                 StopAudioStreamForPlayer(playerid);
  238.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_rock/all/nrj_161510.mp3");
  239.                 RadioON[playerid] = true;
  240.             }
  241.             if(listitem == 25)
  242.             {
  243.                 StopAudioStreamForPlayer(playerid);
  244.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_running/all/nrj_162813.mp3");
  245.                 RadioON[playerid] = true;
  246.             }
  247.             if(listitem == 26)
  248.             {
  249.                 StopAudioStreamForPlayer(playerid);
  250.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_shakira/all/nrj_144619.mp3");
  251.                 RadioON[playerid] = true;
  252.             }
  253.             if(listitem == 27)
  254.             {
  255.                 StopAudioStreamForPlayer(playerid);
  256.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_shop/all/nrj_121822.mp3");
  257.                 RadioON[playerid] = true;
  258.             }
  259.             if(listitem == 28)
  260.             {
  261.                 StopAudioStreamForPlayer(playerid);
  262.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_soleil/all/nrj_155103.mp3");
  263.                 RadioON[playerid] = true;
  264.             }
  265.             if(listitem == 29)
  266.             {
  267.                 StopAudioStreamForPlayer(playerid);
  268.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_black_eyed_peas/all/nrj_161845.mp3");
  269.                 RadioON[playerid] = true;
  270.             }
  271.             if(listitem == 30)
  272.             {
  273.                 StopAudioStreamForPlayer(playerid);
  274.                 PlayAudioStreamForPlayer(playerid, "http://mp3.live.tv-radio.com/nrj_usher/all/nrj_142337.mp3");
  275.                 RadioON[playerid] = true;
  276.             }
  277.             SendClientMessage(playerid, -1, "{9ACD32}[Information]{FFFFFF} Vous écoutez maintenant une radio NRJ.");
  278.         }
  279.     return 1;
  280.     }
  281.  
  282.     if(dialogid == DIALOG_PERSO)
  283.     {
  284.         if(!response)
  285.         {
  286.             ShowPlayerDialog(playerid, DIALOG_RADIOS, DIALOG_STYLE_LIST, "Radios", phrase, "Jouer", "Fermer");
  287.         }
  288.         else
  289.         {
  290.             if(strfind(inputtext, "http://"))
  291.             {
  292.                 if(strfind(inputtext, ".mp3") || strfind(inputtext, ".m3u") || strfind(inputtext, ".ogg") || strfind(inputtext, ".vbs"))
  293.                 {
  294.                     StopAudioStreamForPlayer(playerid);
  295.                     PlayAudioStreamForPlayer(playerid, inputtext);
  296.                 }
  297.                 else
  298.                 {
  299.                     SendClientMessage(playerid, -1, "{FF0000}[Erreur]{FFFFFF} Lien invalide.");
  300.                 }
  301.             }
  302.             else
  303.             {
  304.                 SendClientMessage(playerid, -1, "{FF0000}[Erreur]{FFFFFF} Lien invalide.");
  305.             }
  306.         }
  307.     }
  308.  
  309. return 0;
  310. }
Advertisement
Add Comment
Please, Sign In to add comment