Advertisement
Guest User

Car Radio System

a guest
Jan 16th, 2017
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.17 KB | None | 0 0
  1.  
  2. /*
  3.  
  4. ____________________
  5. | Car Radio System |
  6. | Credits: Benjamin |
  7. | @ 2017 FilterScript|
  8. |____________________|
  9. */
  10.  
  11. #include <a_samp>
  12.  
  13. #define DIALOG_RADIO 500
  14.  
  15. new CarRadio[MAX_VEHICLES];
  16.  
  17. #define FILTERSCRIPT
  18.  
  19. public OnFilterScriptInit()
  20. {
  21. print("\n--------------------------------------");
  22. print("Radio System by Benjamin");
  23. print("--------------------------------------\n");
  24. return 1;
  25. }
  26.  
  27. public OnFilterScriptExit()
  28. {
  29. return 1;
  30. }
  31. public OnPlayerStateChange(playerid, newstate, oldstate)
  32. {
  33. new vehicleid = GetPlayerVehicleID(playerid);
  34. if(newstate == PLAYER_STATE_ONFOOT)
  35. {
  36. StopAudioStreamForPlayer(playerid);
  37. }
  38. if(newstate == PLAYER_STATE_DRIVER)
  39. {
  40. if(CarRadio[vehicleid] == 1)
  41. {
  42. StopAudioStreamForPlayer(playerid);
  43. PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
  44. }
  45. else if(CarRadio[vehicleid] == 2)
  46. {
  47. StopAudioStreamForPlayer(playerid);
  48. PlayAudioStreamForPlayer(playerid, "http://radiotaraf.no-ip.biz:7100");
  49. }
  50. else if(CarRadio[vehicleid] == 3)
  51. {
  52. StopAudioStreamForPlayer(playerid);
  53. PlayAudioStreamForPlayer(playerid, "http://stream.radiozu.ro:8020");
  54. }
  55. else if(CarRadio[vehicleid] == 4)
  56. {
  57. StopAudioStreamForPlayer(playerid);
  58. PlayAudioStreamForPlayer(playerid, "http://live.radiogangsta.ro:8800");
  59. }
  60. else if(CarRadio[vehicleid] == 5)
  61. {
  62. StopAudioStreamForPlayer(playerid);
  63. PlayAudioStreamForPlayer(playerid, "http://www.radiotequila.ro/hiphop.m3u");
  64. }
  65. else if(CarRadio[vehicleid] == 6)
  66. {
  67. StopAudioStreamForPlayer(playerid);
  68. PlayAudioStreamForPlayer(playerid, "http://live.radioclubmix.ro:9999");
  69. }
  70. else if(CarRadio[vehicleid] == 7)
  71. {
  72. StopAudioStreamForPlayer(playerid);
  73. PlayAudioStreamForPlayer(playerid, "http://livemp3.radiopopular.ro:7777");
  74. }
  75. else if(CarRadio[vehicleid] == 8)
  76. {
  77. StopAudioStreamForPlayer(playerid);
  78. PlayAudioStreamForPlayer(playerid, "http://radiofunky.ro/live.pls");
  79. }
  80. else if(CarRadio[vehicleid] == 9)
  81. {
  82. StopAudioStreamForPlayer(playerid);
  83. PlayAudioStreamForPlayer(playerid, "http://dance.radiogangsta.ro:8800");
  84. }
  85. else if(CarRadio[vehicleid] == 0)
  86. {
  87. StopAudioStreamForPlayer(playerid);
  88. }
  89. }
  90. if(newstate == PLAYER_STATE_PASSENGER)
  91. {
  92.  
  93. if(CarRadio[vehicleid] == 1)
  94. {
  95. StopAudioStreamForPlayer(playerid);
  96. PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
  97. }
  98. else if(CarRadio[vehicleid] == 2)
  99. {
  100. StopAudioStreamForPlayer(playerid);
  101. PlayAudioStreamForPlayer(playerid, "http://radiotaraf.no-ip.biz:7100");
  102. }
  103. else if(CarRadio[vehicleid] == 3)
  104. {
  105. StopAudioStreamForPlayer(playerid);
  106. PlayAudioStreamForPlayer(playerid, "http://stream.radiozu.ro:8020");
  107. }
  108. else if(CarRadio[vehicleid] == 4)
  109. {
  110. StopAudioStreamForPlayer(playerid);
  111. PlayAudioStreamForPlayer(playerid, "http://live.radiogangsta.ro:8800");
  112. }
  113. else if(CarRadio[vehicleid] == 5)
  114. {
  115. StopAudioStreamForPlayer(playerid);
  116. PlayAudioStreamForPlayer(playerid, "http://www.radiotequila.ro/hiphop.m3u");
  117. }
  118. else if(CarRadio[vehicleid] == 6)
  119. {
  120. StopAudioStreamForPlayer(playerid);
  121. PlayAudioStreamForPlayer(playerid, "http://live.radioclubmix.ro:9999");
  122. }
  123. else if(CarRadio[vehicleid] == 7)
  124. {
  125. StopAudioStreamForPlayer(playerid);
  126. PlayAudioStreamForPlayer(playerid, "http://livemp3.radiopopular.ro:7777");
  127. }
  128. else if(CarRadio[vehicleid] == 8)
  129. {
  130. StopAudioStreamForPlayer(playerid);
  131. PlayAudioStreamForPlayer(playerid, "http://radiofunky.ro/live.pls");
  132. }
  133. else if(CarRadio[vehicleid] == 9)
  134. {
  135. StopAudioStreamForPlayer(playerid);
  136. PlayAudioStreamForPlayer(playerid, "http://dance.radiogangsta.ro:8800");
  137. }
  138. else if(CarRadio[vehicleid] == 0)
  139. {
  140. StopAudioStreamForPlayer(playerid);
  141. }
  142. }
  143. return 1;
  144. }
  145. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  146. {
  147. if ((newkeys==KEY_CTRL_BACK )&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
  148. {
  149. new string[1000];
  150. strcat(string, "{FFFFFF}Stop Radio\n");
  151. strcat(string, "{F2D068}Asculta {FFFFFF}Pro FM\n"); // http://stream.profm.ro:8012/profm.mp3
  152. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Taraf\n"); // http://live.radiotaraf.com:8181
  153. strcat(string, "{F2D068}Asculta {FFFFFF}Radio ZU\n"); // http://stream.radiozu.ro:8020
  154. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Manele Gangsta\n"); // http://live.radiogangsta.ro:8800
  155. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Tequila\n"); // http://www.radiotequila.ro/hiphop.m3u
  156. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Club Mix\n"); // http://live.radioclubmix.ro:9999
  157. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Popular\n"); // http://livemp3.radiopopular.ro:7777
  158. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Funky\n"); // http://radiofunky.ro/live.pls
  159. strcat(string, "{F2D068}Asculta {FFFFFF}Radio Dance Gangsta\n"); // http://dance.radiogangsta.ro:8800
  160. ShowPlayerDialog(playerid,DIALOG_RADIO,DIALOG_STYLE_LIST,"Car Radio", string, "Play", "Cancel");
  161. }
  162. return 1;
  163. }
  164. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  165. {
  166. new vehicleid = GetPlayerVehicleID(playerid);
  167. if(dialogid == DIALOG_RADIO)
  168. {
  169. if(response)
  170. {
  171. if(listitem == 0)
  172. {
  173. StopAudioStreamForPlayer(playerid);
  174. CarRadio[vehicleid] = 0;
  175. return 1;
  176. }
  177. if(listitem == 1)
  178. {
  179. StopAudioStreamForPlayer(playerid);
  180. PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
  181. CarRadio[vehicleid] = 1;
  182. return 1;
  183. }
  184. if(listitem == 2)
  185. {
  186. StopAudioStreamForPlayer(playerid);
  187. PlayAudioStreamForPlayer(playerid, "http://radiotaraf.no-ip.biz:7100");
  188. CarRadio[vehicleid] = 2;
  189. return 1;
  190. }
  191. if(listitem == 3)
  192. {
  193. StopAudioStreamForPlayer(playerid);
  194. PlayAudioStreamForPlayer(playerid, "http://stream.radiozu.ro:8020");
  195. CarRadio[vehicleid] = 3;
  196. return 1;
  197. }
  198. if(listitem == 4)
  199. {
  200. StopAudioStreamForPlayer(playerid);
  201. PlayAudioStreamForPlayer(playerid, "http://live.radiogangsta.ro:8800");
  202. CarRadio[vehicleid] = 4;
  203. return 1;
  204. }
  205. if(listitem == 5)
  206. {
  207. StopAudioStreamForPlayer(playerid);
  208. PlayAudioStreamForPlayer(playerid, "http://www.radiotequila.ro/hiphop.m3u");
  209. CarRadio[vehicleid] = 5;
  210. return 1;
  211. }
  212. if(listitem == 6)
  213. {
  214. StopAudioStreamForPlayer(playerid);
  215. PlayAudioStreamForPlayer(playerid, "http://live.radioclubmix.ro:9999");
  216. CarRadio[vehicleid] = 6;
  217. return 1;
  218. }
  219. if(listitem == 7)
  220. {
  221. StopAudioStreamForPlayer(playerid);
  222. PlayAudioStreamForPlayer(playerid, "http://livemp3.radiopopular.ro:7777");
  223. CarRadio[vehicleid] = 7;
  224. return 1;
  225. }
  226. if(listitem == 8)
  227. {
  228. StopAudioStreamForPlayer(playerid);
  229. PlayAudioStreamForPlayer(playerid, "http://radiofunky.ro/live.pls");
  230. CarRadio[vehicleid] = 8;
  231. return 1;
  232. }
  233. if(listitem == 9)
  234. {
  235. StopAudioStreamForPlayer(playerid);
  236. PlayAudioStreamForPlayer(playerid, "http://dance.radiogangsta.ro:8800");
  237. CarRadio[vehicleid] = 9;
  238. return 1;
  239. }
  240. }
  241. return 1;
  242. }
  243. return 1;
  244. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement