Advertisement
Private200

Semi-Clickable Textdraw Radio

Mar 26th, 2013
418
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. // The configurations for the radio to work. Not using these may lead to a non-working filterscript.
  4.  
  5. new Text:radiomenu;
  6. new Text:stopradio;
  7. new Text:playradio;
  8.  
  9. // End of the radio configurations.
  10.  
  11. public OnFilterScriptInit()
  12. {
  13. print("\n--------------------------------------");
  14. print(" Private200 radio script with clickable textdraw");
  15. print("--------------------------------------\n");
  16.  
  17. radiomenu = TextDrawCreate(320.000000, 143.000000, "~n~Radio Menu~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~_");
  18. TextDrawAlignment(radiomenu, 2);
  19. TextDrawBackgroundColor(radiomenu, 255);
  20. TextDrawFont(radiomenu, 2);
  21. TextDrawLetterSize(radiomenu, 0.500000, 1.000000);
  22. TextDrawColor(radiomenu, -1);
  23. TextDrawSetOutline(radiomenu, 0);
  24. TextDrawSetProportional(radiomenu, 1);
  25. TextDrawSetShadow(radiomenu, 1);
  26. TextDrawUseBox(radiomenu, 1);
  27. TextDrawBoxColor(radiomenu, 255);
  28. TextDrawTextSize(radiomenu, 45.000000, 115.000000);
  29.  
  30. stopradio = TextDrawCreate(320.000000, 180.000000, "Stop~n~Radio");
  31. TextDrawAlignment(stopradio, 2);
  32. TextDrawBackgroundColor(stopradio, 255);
  33. TextDrawFont(stopradio, 2);
  34. TextDrawLetterSize(stopradio, 0.260000, 0.799999);
  35. TextDrawColor(stopradio, -1);
  36. TextDrawSetOutline(stopradio, 0);
  37. TextDrawSetProportional(stopradio, 1);
  38. TextDrawSetShadow(stopradio, 1);
  39.  
  40. playradio = TextDrawCreate(305.000000, 205.000000, "Play~n~Radio");
  41. TextDrawAlignment(playradio, 0);
  42. TextDrawBackgroundColor(playradio, 255);
  43. TextDrawFont(playradio, 2);
  44. TextDrawLetterSize(playradio, 0.260000, 0.799999);
  45. TextDrawColor(playradio, -1);
  46. TextDrawSetOutline(playradio, 0);
  47. TextDrawSetProportional(playradio, 1);
  48. TextDrawSetShadow(playradio, 1);
  49.  
  50. TextDrawSetSelectable(radiomenu, false);
  51. TextDrawSetSelectable(stopradio, true);
  52. TextDrawSetSelectable(playradio, true);
  53.  
  54. return 1;
  55. }
  56.  
  57. // This will happen when the filterscript will be closed, or better, when the server console is going to be closed
  58.  
  59. public OnFilterScriptExit()
  60. {
  61. TextDrawDestroy(radiomenu);
  62. TextDrawDestroy(stopradio);
  63. TextDrawDestroy(playradio);
  64. return 1;
  65. }
  66.  
  67. public OnPlayerCommandText(playerid, cmdtext[])
  68. {
  69. if (!strcmp("/radio", cmdtext, true))
  70. {
  71. TextDrawShowForPlayer(playerid, radiomenu);
  72. TextDrawShowForPlayer(playerid, playradio);
  73. TextDrawShowForPlayer(playerid, stopradio);
  74. SelectTextDraw(playerid, 0xA3B4C5FF);
  75.  
  76. return 1;
  77. }
  78. return 0;
  79. }
  80. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  81. {
  82. if(_:clickedid != INVALID_TEXT_DRAW) // If the player clicked a valid textdraw, continue with the coding. (_:var removes the Text: tag, to avoid tag mismatch)
  83. {
  84. if(clickedid == playradio)
  85. {
  86. ShowPlayerDialog(playerid, 4568, DIALOG_STYLE_LIST, "Vehicle Radio Tuning", "{FFFF00}Sky Plus FM \n{FFFFFF}Capital FM \n{FFFF00}Planet Rock \n{FFFFFF}Choice FM \n{FFFF00}100% FM \n{FFFFFF}Click2Dance FM \n{FFFF00}Hard FM \n{FFFFFF}Smash Hits \n{FFFF00}Hit Radio\n{FFFFFF}Star FM","Select", "Cancel");
  87. }
  88. else if(clickedid == stopradio)
  89. {
  90. StopAudioStreamForPlayer(playerid);
  91. }
  92.  
  93. TextDrawHideForPlayer(playerid, radiomenu);
  94. TextDrawHideForPlayer(playerid, stopradio);
  95. TextDrawHideForPlayer(playerid, playradio);
  96.  
  97. CancelSelectTextDraw(playerid);
  98. }
  99. return 1;
  100. }
  101.  
  102. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  103. {
  104. if(dialogid == 4568)
  105. {
  106. if(response)
  107. {
  108. if(listitem == 0)
  109. {
  110. PlayAudioStreamForPlayer(playerid, "http://player.stream.akaver.com/streamgen.php?stream=skyplus&format=mp3&quality=hi");
  111. }
  112. if(listitem == 1)
  113. {
  114. PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/CapitalMP3.m3u");
  115. }
  116. if(listitem == 2)
  117. {
  118. PlayAudioStreamForPlayer(playerid, "http://tx.sharp-stream.com/icecast.php?i=planetrock.mp3");
  119. }
  120. if(listitem == 3)
  121. {
  122. PlayAudioStreamForPlayer(playerid, "http://media-ice.musicradio.com/ChoiseFMMP3.m3u");
  123. }
  124. if(listitem == 4)
  125. {
  126. PlayAudioStreamForPlayer(playerid, "http://stream.100pl.nl/100pctne.mp3");
  127. }
  128. if(listitem == 5)
  129. {
  130. PlayAudioStreamForPlayer(playerid, "http://icecast.clickfm.co.il:8002/click2dance");
  131. }
  132. if(listitem == 6)
  133. {
  134. PlayAudioStreamForPlayer(playerid, "http://files.hard.fm/128.pls");
  135. }
  136. if(listitem == 7)
  137. {
  138. PlayAudioStreamForPlayer(playerid, "http://icy-e-01.sharp-stream.com/smashhits.m3u");
  139. }
  140. if(listitem == 8)
  141. {
  142. PlayAudioStreamForPlayer(playerid, "http://mp3stream7.apasf.apa.at:8000");
  143. }
  144. if(listitem == 9)
  145. {
  146. PlayAudioStreamForPlayer(playerid, "http://stream.power.ee/StarFM.m3u");
  147. }
  148. }
  149. return 1;
  150. }
  151.  
  152. return 0;
  153. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement