Jakwob-WG

Radio

Nov 25th, 2014
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.94 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5.  
  6. #define PRESSED(%0) \
  7.     (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) //Detecting keys
  8.  
  9. #define DIALOG_MUSIC 2018
  10.  
  11. new Radio[MAX_PLAYERS];
  12.  
  13. new listitems[] = "1\tDubstep FM\n\
  14.                   2\tCapital FM\n\
  15.                    3\tPulse Radio\n\
  16.                    4\tRadio Klass Romania\n\
  17.                    5\tIts a Trap Radio\n\
  18.                    6\tRussian Hits Radio\n\
  19.                    7\tMadein Hits Radio\n\
  20.                    8\tAbsolute Hits Radio (France)\n\
  21.                    9\tDnB Pirate Radio\n\
  22.                    10\tI Love To Dance Radio\n\
  23.                    11\tElectronic Playground Radio\n\
  24.                    12\tRadio Gothic\n\
  25.                    13\tTurn Off\n\";
  26.  
  27. public OnPlayerConnect(playerid)
  28. {
  29.    Radio[playerid] = 0;
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerDisconnect(playerid, reason)
  34. {
  35.    Radio[playerid] = 0;
  36.     return 1;
  37. }
  38.  
  39. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  40. {
  41.    if(PRESSED(KEY_NO))
  42.    {
  43.         if(IsPlayerInAnyVehicle(playerid))
  44.         {
  45.             if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  46.             {
  47.                 ShowPlayerDialog(playerid,DIALOG_MUSIC,DIALOG_STYLE_LIST,"{33CCFF}List of Music Stations:",listitems,"Tune in","Close");
  48.             }
  49.         }
  50.     }
  51.     return 1;
  52. }
  53.  
  54. public OnPlayerStateChange(playerid, newstate, oldstate)
  55. {
  56.    if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
  57.    {
  58.         if(Radio[playerid] == 1)
  59.         {
  60.             Radio[playerid] = 0;
  61.             StopAudioStreamForPlayer(playerid);
  62.         }
  63.     }
  64.    if(oldstate == PLAYER_STATE_PASSENGER && newstate == PLAYER_STATE_ONFOOT)
  65.    {
  66.         if(Radio[playerid] == 1)
  67.         {
  68.             Radio[playerid] = 0;
  69.             StopAudioStreamForPlayer(playerid);
  70.         }
  71.     }
  72.     return 1;
  73. }
  74.  
  75. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  76. {
  77.    if(dialogid == DIALOG_MUSIC)
  78.    {
  79.        if(response)
  80.        {
  81.            if(listitem == 0)
  82.            {
  83.                if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  84.                {
  85.                     Radio[playerid] = 1;
  86.                     PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=40568");
  87.                     SendClientMessage(playerid, -1, ">  You are tuned into Dubstep FM");
  88.                 }
  89.             }
  90.             else if(listitem == 1)
  91.             {
  92.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  93.                 {
  94.                     Radio[playerid] = 1;
  95.                     PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/CapitalMP3.m3u");
  96.                     SendClientMessage(playerid, -1, ">  You are tuned into Capital FM");
  97.                 }
  98.             }
  99.             else if(listitem == 2)
  100.             {
  101.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  102.                 {
  103.                     Radio[playerid] = 1;
  104.                     PlayAudioStreamForPlayer(playerid, "http://icy3.abacast.com/pulse87-pulse87mp3-64");
  105.                     SendClientMessage(playerid, -1, ">  You are tuned into Pulse 87");
  106.                 }
  107.             }
  108.             else if(listitem == 3)
  109.             {
  110.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  111.                 {
  112.                     Radio[playerid] = 1;
  113.                     PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=7581");
  114.                     SendClientMessage(playerid, -1, ">  You are tuned into Radio Klass Romania");
  115.                 }
  116.             }
  117.             else if(listitem == 4)
  118.             {
  119.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  120.                 {
  121.                     Radio[playerid] = 1;
  122.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3146548/listen.m3u");
  123.                     SendClientMessage(playerid, -1, ">  You are tuned into Its a Trap Radio");
  124.                 }
  125.             }
  126.             else if(listitem == 5)
  127.             {
  128.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  129.                 {
  130.                     Radio[playerid] = 1;
  131.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/1891409/listen.m3u");
  132.                     SendClientMessage(playerid, -1, ">  You are tuned into Russian Hits Radio");
  133.                 }
  134.             }
  135.             else if(listitem == 6)
  136.             {
  137.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  138.                 {
  139.                     Radio[playerid] = 1;
  140.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3064006/listen.m3u");
  141.                     SendClientMessage(playerid, -1, ">  You are tuned into Madein Hits Radio");
  142.                 }
  143.             }
  144.             else if(listitem == 7)
  145.             {
  146.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  147.                 {
  148.                     Radio[playerid] = 1;
  149.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3367058/listen.m3u");
  150.                     SendClientMessage(playerid, -1, ">  You are tuned into Absolute Hits Radio");
  151.                 }
  152.             }
  153.             else if(listitem == 8)
  154.             {
  155.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  156.                 {
  157.                     Radio[playerid] = 1;
  158.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3728175/listen.m3u");
  159.                     SendClientMessage(playerid, -1, ">  You are tuned into DnB Pirate Radio");
  160.                 }
  161.             }
  162.             else if(listitem == 9)
  163.             {
  164.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  165.                 {
  166.                     Radio[playerid] = 1;
  167.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3710153/listen.m3u");
  168.                     SendClientMessage(playerid, -1, ">  You are tuned into I Love To Dance Radio");
  169.                 }
  170.             }
  171.             else if(listitem == 10)
  172.             {
  173.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  174.                 {
  175.                     Radio[playerid] = 1;
  176.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3813588/listen.m3u");
  177.                     SendClientMessage(playerid, -1, ">  You are tuned into Electronic Playground Radio");
  178.                 }
  179.             }
  180.             else if(listitem == 11)
  181.             {
  182.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  183.                 {
  184.                     Radio[playerid] = 1;
  185.                     PlayAudioStreamForPlayer(playerid, "http://dir.xiph.org/listen/3722320/listen.m3u");
  186.                     SendClientMessage(playerid, -1, ">  You are tuned into Radio Gothic");
  187.                 }
  188.             }
  189.             else if(listitem == 12)
  190.             {
  191.                 if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && PLAYER_STATE_PASSENGER)
  192.                 {
  193.                     Radio[playerid] = 0;
  194.                     StopAudioStreamForPlayer(playerid);
  195.                     SendClientMessage(playerid, -1,">  Music off");
  196.                 }
  197.             }
  198.         }
  199.     }
  200.     return 1;
  201. }
Advertisement
Add Comment
Please, Sign In to add comment