Advertisement
Guest User

System Radio by Rochester

a guest
Oct 26th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.39 KB | None | 0 0
  1. /*
  2.                             |==============================|
  3.                             | System Radio by Rochester    |
  4.                             | Credits: Rochester           |
  5.                             |==============================|
  6.  
  7. */
  8.  
  9. #define FILTERSCRIPT
  10. #include <a_samp>
  11.  
  12. new RadioActual[MAX_VEHICLES];
  13.  
  14. #define DIALOG_RADIO 1
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.  
  19.     return 1;
  20. }
  21.  
  22. public OnFilterScriptExit()
  23. {
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerCommandText(playerid, cmdtext[])
  28. {
  29.     if (strcmp("/carradio", cmdtext, true, 10) == 0)
  30.     {
  31.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  32.         {
  33.             new string[50];
  34.             strcat(string, "{F2D068}Asculta {FFFFFF}Pro FM\n");
  35.             strcat(string, "{F2D068}Asculta {FFFFFF}Radio Taraf\n");
  36.             strcat(string, "{FFFFFF}Stop Radio\n");
  37.             ShowPlayerDialog(playerid,DIALOG_RADIO,DIALOG_STYLE_LIST,"Car Radio:", string, "Play", "Cancel");
  38.  
  39.         }
  40.         return 1;
  41.     }
  42.     return 0;
  43. }
  44. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  45. {
  46.     new vehicleid = GetPlayerVehicleID(playerid);
  47.     if(dialogid == DIALOG_RADIO)
  48.     {
  49.         if(response)
  50.         {
  51.             if(listitem == 0)
  52.             {
  53.                 StopAudioStreamForPlayer(playerid);
  54.                 PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
  55.                 RadioActual[vehicleid] = 1;
  56.                 return 1;
  57.             }
  58.             if(listitem == 1)
  59.             {
  60.                 StopAudioStreamForPlayer(playerid);
  61.                 PlayAudioStreamForPlayer(playerid, "http://radiotaraf.no-ip.biz:7100");
  62.                 RadioActual[vehicleid] = 2;
  63.                 return 1;
  64.             }
  65.             if(listitem == 2)
  66.             {
  67.                 StopAudioStreamForPlayer(playerid);
  68.                 RadioActual[vehicleid] = 0;
  69.                 return 1;
  70.             }
  71.        
  72.         }
  73.         return 1;
  74.     }
  75.     return 1;
  76. }
  77. public OnPlayerStateChange(playerid, newstate, oldstate)
  78. {
  79.     new vehicleid = GetPlayerVehicleID(playerid);
  80.     if(newstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_PASSENGER)
  81.     {
  82.         if(RadioActual[vehicleid] == 1)
  83.         {
  84.             StopAudioStreamForPlayer(playerid);
  85.             PlayAudioStreamForPlayer(playerid, "http://stream.profm.ro:8012/profm.mp3");
  86.         }
  87.         else if(RadioActual[vehicleid] == 2)
  88.         {
  89.             StopAudioStreamForPlayer(playerid);
  90.             PlayAudioStreamForPlayer(playerid, "http://radiotaraf.no-ip.biz:7100");
  91.         }
  92.         else if(RadioActual[vehicleid] > 2)
  93.         {
  94.             StopAudioStreamForPlayer(playerid);
  95.         }
  96.     }
  97.     return 1;
  98. }
  99. public OnPlayerExitVehicle(playerid, vehicleid)
  100. {
  101.     StopAudioStreamForPlayer(playerid);
  102.     return 1;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement