HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. //A magyarosítást, és a kiegészítést készítette:BeepBeep & CheeseDave
  2. //a playlist.ini-be jönnek a zenék elérhetõségei, és a playlist.txt-be pedig a lista, amit egy weblapszerkesztõvel könnyedén meg tudsz csinálni!
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <engine>
  6.  
  7. new mp3_nbr=1
  8. new mp3_track=1
  9. new mp3_playlist[30][64]
  10.  
  11. public plugin_init(){
  12. register_plugin("Mp3 Player","2.0","2FuR!uS")
  13. register_dictionary("mp3player.txt")
  14. new mp3_menu_title[128]
  15. format(mp3_menu_title, 127, "%L",LANG_PLAYER,"MP3_MENU_TITLE")
  16. register_menucmd(register_menuid(mp3_menu_title),1023,"mp3Choice")
  17. new mp3_help[128]
  18. format(mp3_help, 127, "%L",LANG_PLAYER,"MP3_HELP")
  19. //parancsok a következõk
  20. register_clcmd("say /mp3","mp3Menu",0,mp3_help)
  21. register_clcmd("say /play","mp3Play",0,mp3_help)
  22. register_clcmd("say /next","mp3Next",0,mp3_help)
  23. register_clcmd("say /prev","mp3Prev",0,mp3_help)
  24. register_clcmd("say /stop","mp3Stop",0,mp3_help)
  25.  
  26. return PLUGIN_CONTINUE
  27. }
  28.  
  29. public mp3List(id){
  30. //hol található a lista fájl. Ezt te szerkeszted, alapból itt van:
  31. show_motd( id,"addons/amxmodx/configs/playlist.txt");
  32. }
  33. public mp3Play(id){
  34. client_cmd(id,"mp3 play %s", mp3_playlist[mp3_track])
  35. client_print(id, print_chat, "%L",LANG_PLAYER,"MP3_PLAY", mp3_playlist[mp3_track], mp3_track, mp3_nbr)
  36. }
  37. public mp3Stop(id){
  38. client_cmd(id,"mp3 stop")
  39. client_print(id, print_chat, "%L",LANG_PLAYER,"MP3_STOP")
  40. mp3_track = 1
  41. }
  42. public mp3Next(id){
  43. mp3_track++
  44. if ( mp3_track == (mp3_nbr+1) ) mp3_track = 1
  45. mp3Play(id)
  46. }
  47. public mp3Prev(id){
  48. mp3_track--
  49. if ( mp3_track == 0 ) mp3_track = mp3_nbr
  50. mp3Play(id)
  51. }
  52.  
  53. public plugin_precache(){
  54. new mp3_file[128]
  55. new length
  56. new playlist_ini_file[64]
  57. new mp3_line
  58. get_configsdir(playlist_ini_file, 63)
  59. format(playlist_ini_file, 63, "%s/playlist.ini", playlist_ini_file)
  60. if (file_exists( playlist_ini_file )){
  61. while(read_file( playlist_ini_file,mp3_line++,mp3_file,sizeof(mp3_file),length)){
  62. if (mp3_file[0] == ';') continue
  63. if (equali(mp3_file,"")) continue
  64. if (equali(mp3_file," ")) continue
  65. if (mp3_file[0] == '/' && mp3_file[1] == '/') continue
  66. format(mp3_playlist[mp3_nbr],sizeof(mp3_playlist)-1,"%s",mp3_file)
  67. precache_generic(mp3_file)
  68. mp3_nbr++
  69. }
  70. } else
  71. server_print("[MP3]ERROR! : A lista (%s) nem talalhato",playlist_ini_file)
  72. server_print("[MP3]Betoltve %d zene %s-bol",mp3_nbr,playlist_ini_file)
  73. mp3_nbr--
  74. return PLUGIN_CONTINUE
  75. }
  76. public mp3Menu(id){
  77. new menuBody[1024]
  78. new key
  79. format(menuBody, 1023, "\r%L\R^n^n\y1.\w %L^n\y2.\w %L^n\y3.\w %L^n\y4.\w %L^n\y5.\w %L^n\y6.\w %L",LANG_PLAYER,"MP3_MENU_TITLE",LANG_PLAYER,"MP3_MENU_LIST",LANG_PLAYER,"MP3_MENU_PLAY",LANG_PLAYER,"MP3_MENU_STOP",LANG_PLAYER,"MP3_MENU_NEXT",LANG_PLAYER,"MP3_MENU_PREV",LANG_PLAYER,"MP3_MENU_EXIT")
  80. key = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)
  81. show_menu(id, key, menuBody)
  82. }
  83. public mp3Choice(id, key){
  84. switch(key){
  85. case 0:
  86. mp3List(id)
  87. case 1:
  88. mp3Play(id)
  89. case 2:
  90. mp3Stop(id)
  91. case 3:
  92. mp3Next(id)
  93. case 4:
  94. mp3Prev(id)
  95. case 5:
  96. return PLUGIN_HANDLED
  97. }
  98. return PLUGIN_HANDLED
  99. }
  100.