Guest User

Music

a guest
May 31st, 2013
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. /*
  2. Creator:
  3. --> *|Samp4Lifes|* <--
  4. Do not remove this credits (haha wtf I know yo will Fuckin' Fuckd ._.
  5. */
  6.  
  7. #include <a_samp>
  8. #include <zcmd>
  9. #include <dini>
  10. #include <streamer>
  11. //#include <sscanf2>
  12. #pragma tabsize 0
  13.  
  14. #define MAX_SONGS 20
  15. new SongName[MAX_SONGS][256],
  16. SongLink[MAX_SONGS][256],
  17. TotalSongs,
  18. bool:SongExists[MAX_SONGS]= false,
  19. SongDialog = 100,
  20. iString[255];
  21. stock SongFile(SongID)
  22. {
  23. new song[256];
  24. format(song,256,"Songs/%d.ini",SongID);
  25. return song;
  26. }
  27. forward LoadSongs();
  28. public LoadSongs()
  29. {
  30. for(new i = 0;i<MAX_SONGS;i++)
  31. {
  32. if(dini_Exists(SongFile(i))){
  33. SongExists[i] = true;
  34. TotalSongs++;
  35. /* new iString[256];
  36.  
  37. iString = dini_Get(SongFile(i),"Link");
  38. sscanf(iString,"p<,>s",SongLink[i]);
  39.  
  40. iString = dini_Get(SongFile(i),"Name");
  41. sscanf(iString,"p<,>s",SongName[i]);
  42. */
  43. SongLink[i] = dini_Get(SongFile(i),"Link");
  44. SongName[i] = dini_Get(SongFile(i),"Name");
  45.  
  46. new Texto[128],Texto2[1500];
  47. format(Texto,128,"ID SONG - %d - NAME %s \nLINK %s\n",i,SongName[i],SongLink[i]);
  48. strcat(Texto2,Texto);
  49. print(Texto2);
  50. }
  51. }
  52.  
  53. return printf("Total Songs Loaded %d",TotalSongs);
  54. }
  55. public OnFilterScriptInit()
  56. {
  57. LoadSongs();
  58. }
  59. CMD:songlist(playerid,params[])
  60. {
  61. new Title[128],
  62. Texto[128],
  63. Total[1500]
  64. ;
  65. for(new i = 0;i<MAX_SONGS;i++)
  66. {
  67. if(SongExists[i] == true){
  68. if(TotalSongs == 0) return SendClientMessage(playerid,-1,"{FF7777}Sorry but there's not any song to reproduce");
  69. format(Texto,128,"{77FF77}ID SONG - {FFFFFF}%d - {77FF77}NAME {FFFFFF}%s\n",i,SongName[i]);
  70. format(Title,128,"{FF7777}Songs Loaded {FFFFFF}%d",TotalSongs);
  71. strcat(Total,Texto);
  72. }
  73. }
  74. return ShowPlayerDialog(playerid,SongDialog+32,2,Title,Total,"Play","Cancel");
  75. }
  76. CMD:stop(playerid,params[]) return StopAudioStreamForPlayer(playerid);
  77.  
  78. public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[])
  79. {
  80. if(dialogid == SongDialog+32 && response){
  81. if(!SongExists[listitem]) return SendClientMessage(playerid,-1,"{FF7777}La cancion no pudo ser cargada");
  82.  
  83. PlayAudioStreamForPlayer(playerid,SongLink[listitem]);
  84. format(iString,256,"{77FF77} ((-> %s <-)) type /StopMusic to stop",SongName[listitem]);
  85. SendClientMessage(playerid,-1,iString);
  86. return 1;
  87. }
  88. return 1;
  89. }
Advertisement
Add Comment
Please, Sign In to add comment