Guest User

Radio system

a guest
Jun 29th, 2013
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.52 KB | None | 0 0
  1. //Radio system - www.forum.sa-mp.com
  2. // Member ForumSAMP: www.forum.sa-mp.com/member.php?u=205879
  3.  
  4. //********includes*********
  5. #include <a_samp>
  6. #pragma tabsize 0
  7. //******defines************
  8. #define COLOR_AZUL 0x0000FFAA
  9. #define COLOR_ROJO 0xFF0000AA
  10. #define COLOR_BLANCO 0xFFFFFFAA
  11. //******news*****************
  12. new static autoradio[MAX_PLAYERS]=0;//0 apagado, 1 Cadena Ser, 2 Rock, 3 Europe FM, 4 reggae, 5 electrónica
  13. //---------------------------------
  14. public OnFilterScriptInit()
  15. {
  16.     print("\n--------------------------------------");
  17.     print(" Radio system - ForumSAMP");
  18.     print("--------------------------------------\n");
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerCommandText(playerid, cmdtext[])
  23. {
  24.     if(strcmp(cmdtext, "/radio", true) == 0)
  25.     {
  26.     new estadojugador = GetPlayerState(playerid);
  27.     if(estadojugador == PLAYER_STATE_DRIVER)
  28.         {
  29.         ShowPlayerDialog( playerid, 100, DIALOG_STYLE_LIST, "STEREO FOX", "Cadena Ser\nRock\nEurope FM\nReggae\nElectronica\nRadio OFF", "Accept", "Cancel" );
  30.         return 1;
  31.         }
  32.         }
  33.     else
  34.         {
  35.         SendClientMessage(playerid, COLOR_ROJO, "You must be in a vehicle");
  36.         return 1;
  37.         }
  38.     return 0;
  39. }
  40. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  41. {
  42.     if(autoradio[playerid]==1)
  43.                 {
  44.                     StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://cadenaser.radio.fr/#%2Fhome.jsf");
  45.             SendClientMessage(playerid, COLOR_BLANCO, "You are listening {00FF7F}Cadena Ser - España");
  46.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to stop or change");
  47.                 }
  48.     if(autoradio[playerid]==2)
  49.                 {
  50.               StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=35999");
  51.             SendClientMessage(playerid, COLOR_BLANCO, "You are listening {00FF7F}Rock Internacional FM");
  52.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to stop or change");
  53.                 }
  54.     if(autoradio[playerid]==3)
  55.                 {
  56.              StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://europafm.radio.fr/");
  57.             SendClientMessage(playerid, COLOR_BLANCO, "You are listening {00FF7F}Europe FM");
  58.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to stop or change");
  59.                 }
  60.     if(autoradio[playerid]==4)
  61.                 {
  62.                 StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=9815");
  63.             SendClientMessage(playerid, COLOR_BLANCO, "You are listening {00FF7F}Reggae - Estilo y vida");
  64.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to stop or change");
  65.                 }
  66.     if(autoradio[playerid]==5)
  67.                 {
  68.               StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=108251");
  69.             SendClientMessage(playerid, COLOR_BLANCO, "You are listening {00FF7F}Electronina - Techno - Dubstep FM");
  70.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to stop or change");
  71.                 }
  72.     if(autoradio[playerid]==0)
  73.                 {
  74.             SendClientMessage(playerid, COLOR_BLANCO, "Radio {00FF7F}off");
  75.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}to ignite");
  76.                 }
  77.  
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerExitVehicle(playerid, vehicleid)
  82. {
  83.     if(autoradio[playerid]==0)
  84.         {
  85.         }
  86.     else
  87.         {
  88.         StopAudioStreamForPlayer(playerid);
  89.         }
  90.     return 1;
  91. }
  92.  
  93. public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[] )
  94. {
  95.     if (response == 1)
  96.     {
  97.         switch ( dialogid )
  98.         {
  99.         case 100 :
  100.             {
  101.             if ( listitem == 0 )
  102.                 {
  103.                     StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://cadenaser.radio.fr/#%2Fhome.jsf");
  104.             SendClientMessage(playerid, COLOR_BLANCO, "Estás escuchando {00FF7F}Reggaeton");
  105.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para parar o cambiar");
  106.             autoradio[playerid]=1;
  107.                 }
  108.                 if ( listitem == 1 )
  109.                 {
  110.              StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=35999");
  111.             SendClientMessage(playerid, COLOR_BLANCO, "Estás escuchando {00FF7F}Rock");
  112.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para parar o cambiar");
  113.             autoradio[playerid]=2;
  114.                 }
  115.                 if ( listitem == 2 )
  116.                 {
  117.              StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=155534");
  118.             SendClientMessage(playerid, COLOR_BLANCO, "Estás escuchando {00FF7F}Pop Rock");
  119.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para parar o cambiar");
  120.             autoradio[playerid]=3;
  121.                 }
  122.                 if ( listitem == 3 )
  123.                 {
  124.                  StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=9815");
  125.             SendClientMessage(playerid, COLOR_BLANCO, "Estás escuchando {00FF7F}Reggae");
  126.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para parar o cambiar");
  127.             autoradio[playerid]=4;
  128.                 }
  129.                 if ( listitem == 4 )
  130.                 {
  131.               StopAudioStreamForPlayer(playerid); PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=108251");
  132.             SendClientMessage(playerid, COLOR_BLANCO, "Estás escuchando {00FF7F}Electronica");
  133.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para parar o cambiar");
  134.             autoradio[playerid]=5;
  135.                 }
  136.           if ( listitem == 5 )
  137.                 {
  138.               StopAudioStreamForPlayer(playerid);
  139.             SendClientMessage(playerid, COLOR_BLANCO, "Radio {00FF7F}Apagada");
  140.             SendClientMessage(playerid, COLOR_BLANCO, "{FFFF00}/autoradio {FFFFFF}para encender");
  141.             autoradio[playerid]=0;
  142.                 }
  143.  
  144.             }
  145.         }
  146.     }
  147.     else
  148.     {
  149.     switch ( dialogid )
  150.         {
  151.         case 100 :
  152.             {
  153.                 StopAudioStreamForPlayer(playerid);
  154.             SendClientMessage(playerid, COLOR_AZUL, "Radio {00FF7F}off.");
  155.                 autoradio[playerid]=0;
  156.                 return 1;
  157.             }
  158.         }
  159.     }
  160.     return 0;
  161. }
  162.    
  163. public OnPlayerDisconnect(playerid, reason)
  164. {
  165. autoradio[playerid]=0;
  166.     return 1;
  167. }
  168. // www.FORUM.SA-MP.com
Advertisement
Add Comment
Please, Sign In to add comment