Guest User

MusicDialog

a guest
Dec 9th, 2011
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.77 KB | None | 0 0
  1. /*
  2.  *                        Music Dialog v1.0
  3.  *                 (c) Copyright 2011 by (Mattos)
  4.  *
  5.  * Author: Mateus Costa de Mattos (http://www.brasilwarzone.com)
  6.  * Date: 9th december 2011
  7.  *
  8.  */
  9.  
  10. #include <a_samp>
  11.  
  12. #define MENUMUSICS      1
  13.  
  14. #define ShowMusicDialog(%0) ShowPlayerDialog(%0, MENUMUSICS, DIALOG_STYLE_LIST, "MUSIC SYSTEM - {006600}By Mattos", "Turn Off Music\nEnter Music URL\nPop/Rock/Eletronica\nMetal\nClássic\nRap/Rip Hop\nDisco", "Select", "Cancel")
  15.  
  16. new MusicOn[MAX_PLAYERS];
  17.  
  18. public OnPlayerCommandText(playerid, cmdtext[])
  19. {
  20.     if(strcmp(cmdtext,"/music",true) == 0)
  21.     {
  22.         ShowMusicDialog(playerid);
  23.         return 1;
  24.     }
  25.     return 0;
  26. }
  27.  
  28. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  29. {
  30.     if(dialogid == MENUMUSICS && response)
  31.     {
  32.         switch(listitem)
  33.         {
  34.             case 0: // Turn Off Music
  35.             {
  36.                 MusicOn[playerid] = 0;
  37.                 SendClientMessage(playerid, -1, "| Music off.");
  38.                 StopAudioStreamForPlayer(playerid);
  39.             }
  40.             case 1: // Enter Mussic URL
  41.             {
  42.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  43.                
  44.                 ShowPlayerDialog(playerid, (MENUMUSICS + 1), DIALOG_STYLE_INPUT,"Enter Music URL", "Enter a URL of a song with the extension .mp3\nand beginning with http://", "Play", "Cancel");
  45.             }
  46.             case 2: // Pop/Rock/Eletronic
  47.             {
  48.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  49.                
  50.                 ShowPlayerDialog(playerid, (MENUMUSICS + 2), DIALOG_STYLE_LIST, "Pop/Rock/Eletronica", "Example\nBack", "Select", "Cancel");
  51.             }
  52.             case 3: // Metal
  53.             {
  54.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  55.                
  56.                 ShowPlayerDialog(playerid, (MENUMUSICS + 3), DIALOG_STYLE_LIST, "Metal", "Example\nBack", "Select", "Cancel");
  57.             }
  58.             case 4: // Clássic
  59.             {
  60.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  61.                
  62.                 ShowPlayerDialog(playerid, (MENUMUSICS + 4), DIALOG_STYLE_LIST, "Clássica", "Example\nBack", "Select", "Cancel");
  63.             }
  64.             case 5: // Rap/Rip Hop
  65.             {
  66.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  67.                
  68.                 ShowPlayerDialog(playerid, (MENUMUSICS + 5), DIALOG_STYLE_LIST, "Rap/Rip Hop", "Exemple\nBack", "Select", "Cancel");
  69.             }
  70.             case 6: // Disco
  71.             {
  72.                 if(MusicOn[playerid] == 1) return SendClientMessage(playerid, -1, "| Turn off the music that is playing to listen to another.");
  73.                
  74.                 ShowPlayerDialog(playerid, (MENUMUSICS + 6), DIALOG_STYLE_LIST, "Disco", "Example\nBack", "Select", "Cancel");
  75.             }            
  76.         }
  77.         return 1;
  78.     }
  79. //==============================================================================
  80. //                               Enter Music URL
  81. //==============================================================================
  82.     if(dialogid == (MENUMUSICS + 1) && response)
  83.     {
  84.         PlayAudioStreamForPlayer(playerid, inputtext);
  85.         MusicOn[playerid] = 1;
  86.         return 1;
  87.     }
  88. //==============================================================================
  89. //                              Pop/Rock/Eletronic
  90. //==============================================================================
  91.     if(dialogid == (MENUMUSICS + 2) && response)
  92.     {
  93.         switch(listitem)
  94.         {
  95.             case 0: PlayAudioStreamForPlayer(playerid, "http://example.mp3"), MusicOn[playerid] = 1;
  96.             case 1: ShowMusicDialog(playerid);
  97.         }
  98.         return 1;
  99.     }
  100. //==============================================================================
  101. //                                  Metal
  102. //==============================================================================
  103.     if(dialogid == (MENUMUSICS + 3) && response)
  104.     {
  105.         switch(listitem)
  106.         {
  107.             case 0: PlayAudioStreamForPlayer(playerid, "http://example.mp3"), MusicOn[playerid] = 1;
  108.             case 1: ShowMusicDialog(playerid);
  109.         }
  110.         return 1;
  111.     }
  112.  
  113. //==============================================================================
  114. //                                   Clássic
  115. //==============================================================================
  116.     if(dialogid == (MENUMUSICS + 4) && response)
  117.     {
  118.         switch(listitem)
  119.         {
  120.             case 0: PlayAudioStreamForPlayer(playerid, "http://example.mp3"), MusicOn[playerid] = 1;
  121.             case 1: ShowMusicDialog(playerid);
  122.         }
  123.         return 1;
  124.     }
  125. //==============================================================================
  126. //                                 Rap/Rip Hop
  127. //==============================================================================
  128.     if(dialogid == (MENUMUSICS + 5) && response)
  129.     {
  130.         switch(listitem)
  131.         {
  132.             case 0: PlayAudioStreamForPlayer(playerid, "http://example.mp3"), MusicOn[playerid] = 1;
  133.             case 1: ShowMusicDialog(playerid);
  134.         }
  135.         return 1;
  136.     }
  137. //==============================================================================
  138. //                                 Disco
  139. //==============================================================================
  140.     if(dialogid == (MENUMUSICS + 6) && response)
  141.     {
  142.         switch(listitem)
  143.         {
  144.             case 0: PlayAudioStreamForPlayer(playerid, "http://example.mp3"), MusicOn[playerid] = 1;
  145.             case 1: ShowMusicDialog(playerid);
  146.         }
  147.         return 1;
  148.     }  
  149.     return 1;
  150. }
  151.  
  152. public OnPlayerConnect(playerid)
  153. {
  154.     MusicOn[playerid] = 0;
  155.     return 1;
  156. }
  157.  
Advertisement
Add Comment
Please, Sign In to add comment