Advertisement
nVidiaX

Rádio Systém + Posluchači v0.2

Apr 6th, 2012
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 16.03 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. #include <a_samp>
  3. ////////////////////////////////////////////////////////////////////////////////
  4. #define DIALOG_RADIO        29999
  5. #define MAX_PLAYERS_EX      100 //Zde si nadefinujte, kolik slotů má váš server. Nejlépe kolik je asi průměrně hráčů na serveru.
  6. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  7. ////////////////////////////////////////////////////////////////////////////////
  8. new Posluchaci[15] = {0,...};
  9. new Posloucham[MAX_PLAYERS_EX];
  10. ////////////////////////////////////////////////////////////////////////////////
  11. public OnFilterScriptInit()
  12. {
  13.     print("\n--------------------------------------");
  14.     print("     Filterscript Rádia by nVidiaX.    ");
  15.     print("--------------------------------------\n");
  16.     return 1;
  17. }
  18. ////////////////////////////////////////////////////////////////////////////////
  19. public OnFilterScriptExit()
  20. {
  21.     return 1;
  22. }
  23. ////////////////////////////////////////////////////////////////////////////////
  24. public OnPlayerRequestClass(playerid, classid)
  25. {
  26.     return 1;
  27. }
  28. ////////////////////////////////////////////////////////////////////////////////
  29. public OnPlayerConnect(playerid)
  30. {
  31.     Posloucham[playerid] = 0;
  32.     return 1;
  33. }
  34. ////////////////////////////////////////////////////////////////////////////////
  35. public OnPlayerDisconnect(playerid, reason)
  36. {
  37.     if(IsPlayerInAnyVehicle(playerid)){
  38.     PosluchacPryc(playerid);
  39.     }
  40.     Posloucham[playerid] = 0;
  41.     return 1;
  42. }
  43. ////////////////////////////////////////////////////////////////////////////////
  44. public OnPlayerSpawn(playerid)
  45. {
  46.     return 1;
  47. }
  48. ////////////////////////////////////////////////////////////////////////////////
  49. public OnPlayerDeath(playerid, killerid, reason)
  50. {
  51.     return 1;
  52. }
  53. ////////////////////////////////////////////////////////////////////////////////
  54. public OnVehicleSpawn(vehicleid)
  55. {
  56.     return 1;
  57. }
  58. ////////////////////////////////////////////////////////////////////////////////
  59. public OnVehicleDeath(vehicleid, killerid)
  60. {
  61.     return 1;
  62. }
  63. ////////////////////////////////////////////////////////////////////////////////
  64. public OnPlayerText(playerid, text[])
  65. {
  66.     return 1;
  67. }
  68. ////////////////////////////////////////////////////////////////////////////////
  69. dcmd_radio(playerid, params[])
  70. {
  71.     #pragma unused params
  72.     if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  73.     new PosluchaciS[1000];
  74.     format(PosluchaciS, 1000,"{FFFFFF}Evropa 2\t(Posluchačů: %d)\nRádio Spin\t(Posluchačů: %d)\nHip Hop Stage\t(Posluchačů: %d)\nDrum and Bass\t(Posluchačů: %d)\nRádio Beat\t(Posluchačů: %d)\nBonton Rádio\t(Posluchačů: %d)\nClub Rádio\t(Posluchačů: %d)\nCountry Rádio\t(Posluchačů: %d)\nFrekvence 1\t(Posluchačů: %d)\nRádio Impuls\t(Posluchačů: %d)\nKiss Morava\t(Posluchačů: %d)\nHelax 93.7\t(Posluchačů: %d)\n{FF0000}Vypnout Rádio"
  75.     ,Posluchaci[0],Posluchaci[1],Posluchaci[2],Posluchaci[3],Posluchaci[4],Posluchaci[5],Posluchaci[6],Posluchaci[7],Posluchaci[8],Posluchaci[9],Posluchaci[10],Posluchaci[11],Posluchaci[12]);
  76.     ShowPlayerDialog(playerid, DIALOG_RADIO, DIALOG_STYLE_LIST, "Výběr Rádia:",PosluchaciS,"Spusťit", "Zavřít");
  77.     return 1;
  78. }
  79. ////////////////////////////////////////////////////////////////////////////////
  80. public OnPlayerCommandText(playerid, cmdtext[])
  81. {
  82.     dcmd(radio, 5, cmdtext);
  83.     return 0;
  84. }
  85. ////////////////////////////////////////////////////////////////////////////////
  86. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  87. {
  88.     return 1;
  89. }
  90. ////////////////////////////////////////////////////////////////////////////////
  91. public OnPlayerExitVehicle(playerid, vehicleid)
  92. {
  93.     return 1;
  94. }
  95. ////////////////////////////////////////////////////////////////////////////////
  96. public OnPlayerStateChange(playerid, newstate, oldstate)
  97. {
  98.     if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER){
  99.         switch(Posloucham[playerid]){
  100.             case 1:{ Posluchaci[0] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/evropa2-128.mp3.m3u"); }
  101.             case 2:{ Posluchaci[1] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/spin64.mp3.m3u"); }
  102.             case 3:{ Posluchaci[2] ++; PlayAudioStreamForPlayer(playerid, "http://www.hiphopstage.cz/radio128.pls"); }
  103.             case 4:{ Posluchaci[3] ++; PlayAudioStreamForPlayer(playerid, "http://www.247drumandbass.com/128k.m3u"); }
  104.             case 5:{ Posluchaci[4] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/beat128.mp3.m3u"); }
  105.             case 6:{ Posluchaci[5] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/bonton128.mp3.m3u"); }
  106.             case 7:{ Posluchaci[6] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/clubradio128.mp3.m3u"); }
  107.             case 8:{ Posluchaci[7] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/country64.mp3.m3u"); }
  108.             case 9:{ Posluchaci[8] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/frekvence1-128.mp3.m3u"); }
  109.             case 10:{ Posluchaci[9] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/impuls128.mp3.m3u"); }
  110.             case 11:{ Posluchaci[10] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/kissmoravaov64.mp3.m3u"); }
  111.             case 12:{ Posluchaci[11] ++; PlayAudioStreamForPlayer(playerid, "http://ice.abradio.cz:8000/helax128.mp3.m3u"); }
  112.         }
  113.     }
  114.     if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER){
  115.         switch(Posloucham[playerid]){
  116.             case 1:{ Posluchaci[0] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/evropa2-128.mp3.m3u"); }
  117.             case 2:{ Posluchaci[1] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/spin64.mp3.m3u"); }
  118.             case 3:{ Posluchaci[2] ++; PlayAudioStreamForPlayer(playerid, "http://www.hiphopstage.cz/radio128.pls"); }
  119.             case 4:{ Posluchaci[3] ++; PlayAudioStreamForPlayer(playerid, "http://www.247drumandbass.com/128k.m3u"); }
  120.             case 5:{ Posluchaci[4] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/beat128.mp3.m3u"); }
  121.             case 6:{ Posluchaci[5] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/bonton128.mp3.m3u"); }
  122.             case 7:{ Posluchaci[6] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/clubradio128.mp3.m3u"); }
  123.             case 8:{ Posluchaci[7] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/country64.mp3.m3u"); }
  124.             case 9:{ Posluchaci[8] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/frekvence1-128.mp3.m3u"); }
  125.             case 10:{ Posluchaci[9] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/impuls128.mp3.m3u"); }
  126.             case 11:{ Posluchaci[10] ++; PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/kissmoravaov64.mp3.m3u"); }
  127.             case 12:{ Posluchaci[11] ++; PlayAudioStreamForPlayer(playerid, "http://ice.abradio.cz:8000/helax128.mp3.m3u"); }
  128.         }
  129.     }
  130.     if(oldstate == PLAYER_STATE_DRIVER){
  131.         PoslouchamPryc(playerid); StopAudioStreamForPlayer(playerid);
  132.     }
  133.     if(oldstate == PLAYER_STATE_PASSENGER){
  134.         PoslouchamPryc(playerid);StopAudioStreamForPlayer(playerid);
  135.     }
  136.     return 1;
  137. }
  138. ////////////////////////////////////////////////////////////////////////////////
  139. public OnPlayerEnterCheckpoint(playerid)
  140. {
  141.     return 1;
  142. }
  143. ////////////////////////////////////////////////////////////////////////////////
  144. public OnPlayerLeaveCheckpoint(playerid)
  145. {
  146.     return 1;
  147. }
  148. ////////////////////////////////////////////////////////////////////////////////
  149. public OnPlayerEnterRaceCheckpoint(playerid)
  150. {
  151.     return 1;
  152. }
  153. ////////////////////////////////////////////////////////////////////////////////
  154. public OnPlayerLeaveRaceCheckpoint(playerid)
  155. {
  156.     return 1;
  157. }
  158. ////////////////////////////////////////////////////////////////////////////////
  159. public OnRconCommand(cmd[])
  160. {
  161.     return 1;
  162. }
  163. ////////////////////////////////////////////////////////////////////////////////
  164. public OnPlayerRequestSpawn(playerid)
  165. {
  166.     return 1;
  167. }
  168. ////////////////////////////////////////////////////////////////////////////////
  169. public OnObjectMoved(objectid)
  170. {
  171.     return 1;
  172. }
  173. ////////////////////////////////////////////////////////////////////////////////
  174. public OnPlayerObjectMoved(playerid, objectid)
  175. {
  176.     return 1;
  177. }
  178. ////////////////////////////////////////////////////////////////////////////////
  179. public OnPlayerPickUpPickup(playerid, pickupid)
  180. {
  181.     return 1;
  182. }
  183. ////////////////////////////////////////////////////////////////////////////////
  184. public OnVehicleMod(playerid, vehicleid, componentid)
  185. {
  186.     return 1;
  187. }
  188. ////////////////////////////////////////////////////////////////////////////////
  189. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  190. {
  191.     return 1;
  192. }
  193. ////////////////////////////////////////////////////////////////////////////////
  194. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  195. {
  196.     return 1;
  197. }
  198. ////////////////////////////////////////////////////////////////////////////////
  199. public OnPlayerSelectedMenuRow(playerid, row)
  200. {
  201.     return 1;
  202. }
  203. ////////////////////////////////////////////////////////////////////////////////
  204. public OnPlayerExitedMenu(playerid)
  205. {
  206.     return 1;
  207. }
  208. ////////////////////////////////////////////////////////////////////////////////
  209. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  210. {
  211.     return 1;
  212. }
  213. ////////////////////////////////////////////////////////////////////////////////
  214. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  215. {
  216.     return 1;
  217. }
  218. ////////////////////////////////////////////////////////////////////////////////
  219. public OnRconLoginAttempt(ip[], password[], success)
  220. {
  221.     return 1;
  222. }
  223. ////////////////////////////////////////////////////////////////////////////////
  224. public OnPlayerUpdate(playerid)
  225. {
  226.     return 1;
  227. }
  228. ////////////////////////////////////////////////////////////////////////////////
  229. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  230. {
  231.     if(dialogid == DIALOG_RADIO){
  232.         if(response){
  233.             if(listitem == 0){
  234.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  235.                 PosluchacPryc(playerid);Posloucham[playerid] = 1;Posluchaci[0] ++;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/evropa2-128.mp3.m3u");
  236.                 return 1;
  237.             }
  238.             else if(listitem == 1){
  239.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  240.                 PosluchacPryc(playerid);Posloucham[playerid] = 2;Posluchaci[1] ++;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/spin64.mp3.m3u");
  241.                 return 1;
  242.             }
  243.             else if(listitem == 2){
  244.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  245.                 PosluchacPryc(playerid);Posluchaci[2] ++;Posloucham[playerid] = 3;PlayAudioStreamForPlayer(playerid, "http://www.hiphopstage.cz/radio128.pls");
  246.                 return 1;
  247.             }
  248.             else if(listitem == 3){
  249.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  250.                 PosluchacPryc(playerid);Posluchaci[3] ++;Posloucham[playerid] = 4;PlayAudioStreamForPlayer(playerid, "http://www.247drumandbass.com/128k.m3u");
  251.                 return 1;
  252.             }
  253.             else if(listitem == 4){
  254.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  255.                 PosluchacPryc(playerid);Posluchaci[4] ++;Posloucham[playerid] = 5;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/beat128.mp3.m3u");
  256.                 return 1;
  257.             }
  258.             else if(listitem == 5){
  259.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  260.                 PosluchacPryc(playerid);Posluchaci[5] ++;Posloucham[playerid] = 6;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/bonton128.mp3.m3u");
  261.                 return 1;
  262.             }
  263.             else if(listitem == 6){
  264.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  265.                 PosluchacPryc(playerid);Posluchaci[6] ++;Posloucham[playerid] = 7;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/clubradio128.mp3.m3u");
  266.                 return 1;
  267.             }
  268.             else if(listitem == 7){
  269.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  270.                 PosluchacPryc(playerid);Posluchaci[7] ++;Posloucham[playerid] = 8;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/country64.mp3.m3u");
  271.                 return 1;
  272.             }
  273.             else if(listitem == 8){
  274.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  275.                 PosluchacPryc(playerid);Posluchaci[8] ++;Posloucham[playerid] = 9;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/frekvence1-128.mp3.m3u");
  276.                 return 1;
  277.             }
  278.             else if(listitem == 9){
  279.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  280.                 PosluchacPryc(playerid);Posluchaci[9] ++;Posloucham[playerid] = 10;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/impuls128.mp3.m3u");
  281.                 return 1;
  282.             }
  283.             else if(listitem == 10){
  284.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  285.                 PosluchacPryc(playerid);Posluchaci[10] ++;Posloucham[playerid] = 11;PlayAudioStreamForPlayer(playerid, "http://www.play.cz/radio/kissmoravaov64.mp3.m3u");
  286.                 return 1;
  287.             }
  288.             else if(listitem == 11){
  289.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  290.                 PosluchacPryc(playerid);Posluchaci[11] ++;Posloucham[playerid] = 12;PlayAudioStreamForPlayer(playerid, "http://ice.abradio.cz:8000/helax128.mp3.m3u");
  291.                 return 1;
  292.             }
  293.             else if(listitem == 12){
  294.                 if(!IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, 29999, DIALOG_STYLE_MSGBOX, "{FF0000}CHYBA","{FF0000}CHYBA: Nejste ve vozidle.","Zavřít","");
  295.                 PosluchacPryc(playerid);Posloucham[playerid] = 0;StopAudioStreamForPlayer(playerid);
  296.                 return 1;
  297.             }
  298.         }
  299.     }
  300.     return 1;
  301. }
  302. ////////////////////////////////////////////////////////////////////////////////
  303. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  304. {
  305.     return 1;
  306. }
  307. ////////////////////////////////////////////////////////////////////////////////
  308. stock PosluchacPryc(playerid)
  309. {
  310.     switch(Posloucham[playerid]){
  311.         case 1: Posluchaci[0] --;case 2: Posluchaci[1] --;case 3: Posluchaci[2] --;case 4: Posluchaci[3] --;case 5: Posluchaci[4] --;case 6: Posluchaci[5] --;case 7: Posluchaci[6] --;case 8: Posluchaci[7] --;case 9: Posluchaci[8] --;case 10: Posluchaci[9] --;case 11: Posluchaci[10] --;case 12: Posluchaci[11] --;case 13: Posluchaci[12] --;case 14: Posluchaci[13] --;case 15: Posluchaci[14] --;
  312.     }
  313.     Posloucham[playerid] = 0;
  314. }
  315. ////////////////////////////////////////////////////////////////////////////////
  316. stock PoslouchamPryc(playerid)
  317. {
  318.     switch(Posloucham[playerid]){
  319.         case 1: Posluchaci[0] --;case 2: Posluchaci[1] --;case 3: Posluchaci[2] --;case 4: Posluchaci[3] --;case 5: Posluchaci[4] --;case 6: Posluchaci[5] --;case 7: Posluchaci[6] --;case 8: Posluchaci[7] --;case 9: Posluchaci[8] --;case 10: Posluchaci[9] --;case 11: Posluchaci[10] --;case 12: Posluchaci[11] --;case 13: Posluchaci[12] --;case 14: Posluchaci[13] --;case 15: Posluchaci[14] --;
  320.     }
  321. }
  322. ////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement