Advertisement
Guest User

[FilterScript] Sistema de Radios em Veiculos [v1.0]

a guest
Dec 1st, 2013
1,038
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.94 KB | None | 0 0
  1. /*
  2.              Sistema de Radios em Veiculos
  3.              
  4.     Versão do Script: 1.0
  5.     Criado por: NurbWill
  6.  
  7. */
  8.  
  9. #include <a_samp>
  10.  
  11. new RadioVeiculoID[MAX_VEHICLES];
  12.  
  13. enum RadioDataEnum
  14. {
  15.     ShoutcastRadioID[8],
  16.     ShoutcastRadioName[70]
  17. }
  18.  
  19. new RadioData[][RadioDataEnum] = {
  20. {"914897","idobi Radio: New. Music. Unfiltered. idobi.com"},
  21. {"175821","COOLfahrenheit 93"},
  22. {"166835","Alex Jones'Infowars.com"},
  23. {"16101","RADIO SOUND POP'BRASIL"},
  24. {"66765","Radio Brasil Hits'BRASILHITS.COM"},
  25. {"149762","www.requestradio.in.th"},
  26. {"7581","BlackBeats.FM'finest in blackbeats'powered by surfmusik.de'"},
  27. {"56491","TamilFlash.Fm |Tamil Radio Powered by: Brapa.Com"},
  28. {"182443","Radio Television Caraibes broadcasting live from Port-au-Prince Haiti"},
  29. {"549041","181.FM'Christmas Mix"},
  30. {"102286","Adom 106.3FM Powered by Mediagh"},
  31. {"9483900","Lankasri FM"},
  32. {"197330","COOLfahrenheit 93"},
  33. {"298757","RAC1. Des de Catalunya per tot el mon"},
  34. {"38486","ANTENA1'94 7 FM"},
  35. {"12380","waizon radio"},
  36. {"675457","181.FM'Christmas Traditional Classics"},
  37. {"19035","AlTools"},
  38. {"22146","Venice Classic Radio Italia"},
  39. {"8318","HOT 108 JAMZ'#1 FOR HIP HOP'www.hot108.com'"},
  40. {"9256827","KissFM Romania'www.kissfm.ro"},
  41. {"223772","MusicRadio.in.th@By Pj NeoOne"},
  42. {"33437","COOLfahrenheit 93"},
  43. {"104559","Radio IKIMfm Malaysia"},
  44. {"49892","100Hitz'Top 40"},
  45. {"1685803","Radio ZU Live"},
  46. {"402","radio city 24 & 5aab radio punjabi radio"},
  47. {"7540","CINEMIX"},
  48. {"1564322","TechnoBase.FM'24h Techno, Dance, HandsUp and More"},
  49. {"194257","AnimeNfo Radio | Serving you the best Anime and Doujin music!"},
  50. {"1685803","Radio ZU Live"},
  51. {"402","radio city 24 & 5aab radio punjabi radio"},
  52. {"7540","CINEMIX"},
  53. {"1564322","TechnoBase.FM'24h Techno, Dance, HandsUp and More"},
  54. {"194257","AnimeNfo Radio | Serving you the best Anime and Doujin music!"},
  55. {"27824","Groove Salad (SomaFM)"},
  56. {"1640384","Live Kirtan'Sri harmandir Sahib'Golden Temple"},
  57. {"80613","KRAL FM"},
  58. {"508962","181.FM'PARTY 181 -=- Your Official Party Station!"},
  59. {"366480","181.fm'True R&B"},
  60. {"651101","CHILLOUT LOUNGE RADIO (1.FM TM)"},
  61. {"42016","RADIO SOUND POP'BRASIL"},
  62. {"196253","181.fm'Awesome 80's"},
  63. {"9479710","Tinimy.de"},
  64. {"221956","181.FM'Kickin' Country'Today's BEST Country!"},
  65. {"19460","181.fm'The Heart (All Love Songs)"},
  66. {"31645","ChartHits.FM'Top 40 Radio'Mega Hot Music!"},
  67. {"1660760","Magic FM Romania www.magicfm.ro Soft Music"},
  68. {"220986","COOLcelsius 91.5"},
  69. {"1697879","iKyzaa DJ"},
  70. {"144896","[WINK.IN.TH]-THAILAND"},
  71. {"1599623","Virginhitz 95.5"},
  72. {"12161","Coles Radio National"},
  73. {"1569211","RadioMv.com | Russian Christian Radio (128 Kbps)"},
  74. {"19972","181.FM'POWER 181 -=[: The Hitz Channel :]=- www.181.fm"},
  75. {"92498","181.fm' The Mix Channel (70s, 80s, 90s and Today's Best Music)"},
  76. {"144936","Alex Jones'Infowars.com"},
  77. {"71946","Nhyira 104.5 FM Powered by Mediagh"},
  78. {"17399","Radioparty.pl'Techno, Dance, Club, Hands Up, House, Trance"},
  79. {"14659","Eazy1055"},
  80. {"37586","181.FM'The Buzz (Your Alternative Station!)"},
  81. {"691274","1.FM'ABSOLUTE TOP 40 RADIO"},
  82. {"633861","181.FM'Christmas Smooth Jazz"},
  83. {"57352","HouseTime.FM24h House, Electro and More"},
  84. {"105867","181.FM'The BEAT * #1 For HipHop and R&B"}
  85. };
  86.  
  87. public OnFilterScriptInit()
  88. {
  89.     print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  90.     print("             SHOUTCAST RADIO SYSTEM");
  91.     print(" ");
  92.     print("  Criado por: NurbWill");
  93.     print("  Versão: 1.0");
  94.     print(" ");
  95.     print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
  96.     return 1;
  97. }
  98.  
  99. public OnFilterScriptExit()
  100. {
  101.     return 1;
  102. }
  103.  
  104. public OnPlayerCommandText(playerid, cmdtext[])
  105. {
  106.     if (strcmp("/vradio", cmdtext, true, 10) == 0)
  107.     {
  108.         if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{1B9DFA}[Shoutcast Radio]{8C8C8C} Você não está em um veiculo.");
  109.         new String_Dialog[2100], String_Nome[70];
  110.         for(new i = 0; i < 65; ++i)
  111.         {
  112.             format(String_Nome, sizeof(String_Nome), "%s", RadioData[i][ShoutcastRadioName]);
  113.             format(String_Dialog, sizeof(String_Dialog), "%s %s\n", String_Dialog, String_Nome);
  114.         }
  115.         ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_LIST, "{1B9DFA}[Shoutcast Radio]{2A7D52} Uma variedade de radios para você ouvir!", String_Dialog, "Tocar", "Fechar");
  116.         return 1;
  117.     }
  118.    
  119.     if (strcmp("/pararradio", cmdtext, true, 10) == 0)
  120.     {
  121.         new vehicleid = GetPlayerVehicleID(playerid);
  122.         if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "{1B9DFA}[Shoutcast Radio]{8C8C8C} Você não está em um veiculo.");
  123.         if(RadioVeiculoID[vehicleid] == 0) return SendClientMessage(playerid, -1, "{1B9DFA}[Shoutcast Radio]{8C8C8C} Este veiculo não está tocando nenhuma radio.");
  124.         RadioVeiculoID[vehicleid] = 0;
  125.         StopAudioStreamForPlayer(playerid);
  126.         SendClientMessage(playerid, -1, "{1B9DFA}[Shoutcast Radio]{8C8C8C} Você desligou a radio.");
  127.         for(new i = 0; i < MAX_PLAYERS; i++) {
  128.             if(GetPlayerVehicleID(i) == vehicleid && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_PASSENGER && i != playerid)
  129.             {
  130.                 StopAudioStreamForPlayer(i);
  131.             }
  132.         }
  133.         return 1;
  134.     }
  135.     return 0;
  136. }
  137.  
  138. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  139. {
  140.     if(dialogid == 5000)
  141.     {
  142.         if(response)
  143.         {
  144.             new rVeiculo = GetPlayerVehicleID(playerid), FaixaID = listitem, Play_String[74];
  145.             format(Play_String, sizeof(Play_String), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=%s", RadioData[FaixaID][ShoutcastRadioID]);
  146.             PlayAudioStreamForPlayer(playerid, Play_String);
  147.             RadioVeiculoID[rVeiculo] = FaixaID+1;
  148.             for(new i = 0; i < MAX_PLAYERS; i++) {
  149.                 if(GetPlayerVehicleID(i) == rVeiculo && IsPlayerInAnyVehicle(i) && GetPlayerState(i) == PLAYER_STATE_PASSENGER && i != playerid) {
  150.                     PlayAudioStreamForPlayer(i, RadioData[FaixaID][ShoutcastRadioID]);
  151.                 }
  152.             }
  153.         }
  154.     }
  155.     return 1;
  156. }
  157.  
  158. public OnPlayerStateChange(playerid, newstate, oldstate)
  159. {
  160.     if(newstate == PLAYER_STATE_DRIVER) {
  161.         if(RadioVeiculoID[GetPlayerVehicleID(playerid)] != 0) {
  162.             new PegarRadioID = RadioVeiculoID[GetPlayerVehicleID(playerid)]-1, Play_String[74];
  163.             format(Play_String, sizeof(Play_String), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=%s", RadioData[PegarRadioID][ShoutcastRadioID]);
  164.             PlayAudioStreamForPlayer(playerid, Play_String);
  165.         }
  166.     }
  167.     if(newstate == PLAYER_STATE_PASSENGER) {
  168.         if(RadioVeiculoID[GetPlayerVehicleID(playerid)] != 0) {
  169.             new PegarRadioID = RadioVeiculoID[GetPlayerVehicleID(playerid)]-1, Play_String[74];
  170.             format(Play_String, sizeof(Play_String), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=%s", RadioData[PegarRadioID][ShoutcastRadioID]);
  171.             PlayAudioStreamForPlayer(playerid, Play_String);
  172.         }
  173.     }
  174.     if(newstate == PLAYER_STATE_ONFOOT) StopAudioStreamForPlayer(playerid);
  175.     return 1;
  176. }
  177.  
  178. public OnVehicleSpawn(vehicleid)
  179. {
  180.     RadioVeiculoID[vehicleid] = 0;
  181.     return 1;
  182. }
  183.  
  184. public OnVehicleDeath(vehicleid, killerid)
  185. {
  186.     RadioVeiculoID[vehicleid] = 0;
  187.     return 1;
  188. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement