Advertisement
Guest User

sAudio

a guest
Oct 30th, 2012
497
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.29 KB | None | 0 0
  1.  
  2. /*
  3.    sAudio by Stu1
  4.    contact me @ http://vandriverinternational.eu
  5. */
  6. #include <a_samp>
  7. #include <zcmd>
  8.  
  9.  
  10. //define
  11.  
  12. #define SAUDIO_DIALOG 9997
  13. #define SAUDIOURL_DIALOG 9998
  14.  
  15. //var
  16. new radio;
  17.  
  18.  
  19. public OnFilterScriptInit()
  20. {
  21.     print("\n--------------------------------------");
  22.     print("sAudio Started");
  23.     print("--------------------------------------\n");
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerStateChange(playerid, newstate, oldstate)
  28. {
  29.     if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
  30.     {
  31.         switch (radio)
  32.                     {
  33.                     case 0: StopAudioStreamForPlayer(playerid);
  34.                     case 1: {PlayAudioStreamForPlayer(playerid, "http://www.radioseven.se/128.pls"); GameTextForPlayer(playerid,"~y~Radio Seven",2000,5);}
  35.                     case 2: {PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377360"); GameTextForPlayer(playerid,"~y~HouseTime.FM",2000,5);}
  36.                     case 3: {PlayAudioStreamForPlayer(playerid, "http://tx.whatson.com/icecast.php?i=kerrang.mp3.m3u"); GameTextForPlayer(playerid,"~y~Kerrang Radio",2000,5);}
  37.                     case 4: {PlayAudioStreamForPlayer(playerid, "http://www.rgrfm.be/rgr1283.pls"); GameTextForPlayer(playerid,"~y~RGR FM",2000,5);}
  38.                     case 5: {PlayAudioStreamForPlayer(playerid, "http://listen.technobase.fm/dsl.pls"); GameTextForPlayer(playerid,"~y~TechnoBase",2000,5);}
  39.                     case 6: {PlayAudioStreamForPlayer(playerid, "http://radio.bigupradio.com.:8000/listen.pls"); GameTextForPlayer(playerid,"~y~Big Up Radio",2000,5);}
  40.                     }
  41.     }
  42.  
  43.     if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
  44.     {
  45.         StopAudioStreamForPlayer(playerid);
  46.     }
  47.     return 1;
  48. }
  49.  
  50.  
  51. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  52. {
  53.     if(dialogid == 9997)
  54.     {
  55.         if(response)
  56.         {
  57.             if(listitem == 0)
  58.             {
  59.                 PlayAudioStreamForPlayer(playerid, "http://www.radioseven.se/128.pls");
  60.                 GameTextForPlayer(playerid,"~y~Radio Seven",2000,5);
  61.                 radio = 1;
  62.             }
  63.             if(listitem == 1)
  64.             {
  65.                 PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377360");
  66.                 GameTextForPlayer(playerid,"~y~HouseTime.FM",2000,5);
  67.                 radio = 2;
  68.             }
  69.             if(listitem == 2)
  70.             {
  71.                 PlayAudioStreamForPlayer(playerid, "http://tx.whatson.com/icecast.php?i=kerrang.mp3.m3u");
  72.                 GameTextForPlayer(playerid,"~y~Kerrang Radio",2000,5);
  73.                 radio = 3;
  74.             }
  75.             if(listitem == 3)
  76.             {
  77.                 PlayAudioStreamForPlayer(playerid, "http://www.rgrfm.be/rgr1283.pls");
  78.                 GameTextForPlayer(playerid,"~y~RGR FM",2000,5);
  79.                 radio = 4;
  80.             }
  81.             if(listitem == 4)
  82.             {
  83.                 PlayAudioStreamForPlayer(playerid, "http://listen.technobase.fm/dsl.pls");
  84.                 GameTextForPlayer(playerid,"~y~TechnoBase",2000,5);
  85.                 radio = 5;
  86.             }
  87.             if(listitem == 5)
  88.             {
  89.                 PlayAudioStreamForPlayer(playerid, "http://radio.bigupradio.com.:8000/listen.pls");
  90.                 GameTextForPlayer(playerid,"~y~Big Up Radio",2000,5);
  91.                 radio = 6;
  92.             }
  93.             if(listitem == 6)
  94.             {
  95.                 ShowPlayerDialog(playerid, SAUDIOURL_DIALOG, DIALOG_STYLE_INPUT, "{FFFFFF}Enter Station URL:","Enter the URl:\nEx. http://listen.technobase.fm/dsl.pls", "Confirm", "Close");
  96.             }
  97.             if(listitem == 7)
  98.             {
  99.                 StopAudioStreamForPlayer(playerid);
  100.                 radio = 0;
  101.             }
  102.         }
  103.      }
  104.     if(dialogid == 9998)
  105.     {
  106.         if(response)
  107.         {
  108.          if(strlen(inputtext) > 0)
  109.                  {
  110.                     PlayAudioStreamForPlayer(playerid, inputtext);
  111.                     GameTextForPlayer(playerid,"~y~Custom URL",2000,5);
  112.                  }
  113.                  else
  114.                  {
  115.                      SendClientMessage(playerid,0xFFFFFFAA,"Not Valid");
  116.                  }
  117.  
  118.  
  119.         }
  120.      }
  121.  
  122.  
  123.  }
  124.  
  125.  
  126. CMD:radio(playerid, params[])
  127. {
  128.     if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1,"You can't use the radio on foot.");
  129.     {
  130.      new  sAudio[1024];
  131.      format(sAudio, sizeof(sAudio), "Radio Seven\nHouseTime.FM\nKerrang\nRGR FM\nTechnoBase\nBig Up Radio\n{00FF00}Enter URL\n{FF0040}Stop Radio");
  132.  
  133.      ShowPlayerDialog(playerid, SAUDIO_DIALOG, DIALOG_STYLE_LIST, "Choose Station:", sAudio, "Play", "Close");
  134.     }
  135.  
  136.     return 1;
  137.  
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement