Advertisement
DominikMarvLisy

[NOT MY] Music [FROM FOLDER]

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