Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.08 KB | None | 0 0
  1. /* Formatright © 2012, TigeQ Aka CreePs
  2. *
  3. * Advanced Music Menu is free software;
  4. * This program is free for all players
  5. * This program has build in the hope to help for some players
  6. * You can published this program only with Formatright
  7. *
  8. * Thanks for reading my Formatright Enjoy this program
  9. *
  10. * Please do not change the credits thank you!
  11. *
  12. * (** if your name is "Noam" please delete this program **)
  13. * (** if your name is "Noam" dont change CREDITS **)
  14. * (** if your name is "Noam" GO FUCK YOUR SELF **)
  15. */
  16.  
  17. #include <amxmodx>
  18.  
  19. #define VERSION "1.0"
  20.  
  21. #define ADMIN_ACCESS ADMIN_KICK
  22.  
  23. #pragma semicolon 1
  24. enum // check the action(heb or eng) of the menu
  25. {
  26. ENG_MENU,
  27. HEB_MENU
  28. };
  29.  
  30. new const cmdOpen[][] = // all cmds to open the music menu
  31. {
  32. "say /music",
  33. "say music",
  34. "say_team /music",
  35. "say_team music",
  36. "nightvision"
  37. };
  38.  
  39. new const Eng_Songs_dir[][] = // put here all english songs ** NO NEEDED SOUND/ **
  40. {
  41. "Music/English/eng_song1.mp3",
  42. "Music/English/eng_song2.mp3",
  43. "Music/English/eng_song3.mp3"
  44. };
  45.  
  46. new const Eng_Songs_name[][] = // put here all english songs names that will be in the menu
  47. {
  48. "Eng Song #1",
  49. "Eng Song #2",
  50. "Eng Song #3"
  51. };
  52.  
  53. new const Heb_Songs_dir[][] = // put here all hebrew songs ** NO NEEDED SOUND/ **
  54. {
  55. "Music/Hebrew/heb_song1.mp3",
  56. "Music/Hebrew/heb_song2.mp3",
  57. "Music/Hebrew/heb_song3.mp3"
  58. };
  59.  
  60. new const Heb_Songs_name[][] = // put here all hebrew songs names that will be in the menu
  61. {
  62. "Heb Song #1",
  63. "Heb Song #2",
  64. "Heb Song #3"
  65. };
  66.  
  67. new menu_action[ 33 ];
  68. new play_for_all[ 33 ];
  69. new Float: Volume[ 33 ];
  70. public plugin_precache()
  71. {
  72. for( new i; i < sizeof Eng_Songs_dir; i++ )
  73. precache_sound( Eng_Songs_dir[ i ] );
  74.  
  75. for( new i; i < sizeof Heb_Songs_dir; i++ )
  76. precache_sound( Heb_Songs_dir[ i ] );
  77. }
  78.  
  79. public plugin_init() {
  80. register_plugin( "Advanced Music Menu", VERSION, "CreePs" );
  81.  
  82. for( new i; i < sizeof cmdOpen; i++ )
  83. register_clcmd( cmdOpen[ i ], "cmdShowMenu" );
  84. }
  85.  
  86. public client_putinserver( client )
  87. {
  88. if( get_user_flags( client ) & ADMIN_ACCESS )
  89. play_for_all[ client ] = true;
  90. else
  91. play_for_all[ client ] = false;
  92.  
  93. Volume[ client ] = 0.5;
  94. }
  95.  
  96. public cmdShowMenu( client )
  97. {
  98. static title[ 128 ], item[ 128 ];
  99. formatex( title, sizeof( title ) - 1, "\y[Music]\d Music Main Menu^n\wby CreePs" );
  100. new menu = menu_create( title, "caseMenu" );
  101.  
  102. menu_additem( menu, "English Music", "1" );
  103. menu_additem( menu, "Hebrew Music", "2" );
  104. formatex( item, sizeof( item ) - 1, "Stop Music -\y for %s", play_for_all[ client ] ? "All" : "My Self" ) && menu_additem( menu, item, "3" );
  105. formatex( item, sizeof( item ) - 1, "Play For All Players -\y %s", play_for_all[ client ] ? "Yes" : "No" ) && menu_additem( menu, item, "4" );
  106. formatex( item, sizeof( item ) - 1, "Volume -\y %.1f", Volume[ client ] ) && menu_additem( menu, item, "5" );
  107.  
  108. menu_setprop( menu, MPROP_EXITNAME, "\yClose" );
  109. menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  110. menu_display( client, menu, 0 );
  111. }
  112.  
  113. public caseMenu( client, menu, item )
  114. {
  115. if ( item == MENU_EXIT )
  116. {
  117. menu_destroy( menu );
  118. return;
  119. }
  120. new name[ 32 ];
  121. get_user_name( client, name , sizeof( name ) - 1);
  122. switch( item )
  123. {
  124. case 0: menu_action[ client ] = ENG_MENU;
  125. case 1: menu_action[ client ] = HEB_MENU;
  126. case 2: client_cmd( play_for_all[ client ] ? 0 : client, "mp3 stop" ), ColorChat( play_for_all[ client ] ? 0 : client, "%s^x04%s^x01 has stoped the music.", play_for_all[ client ] ? "Admin: " : "", name );
  127. case 3: if( get_user_flags( client ) & ADMIN_ACCESS ) play_for_all[ client ] = !play_for_all[ client ];
  128. case 4: if( Volume[ client ] > 1.0 )
  129. Volume[ client ] = 0.1;
  130. else
  131. Volume[ client ] += 0.1;
  132. }
  133.  
  134. if(item < 2)
  135. cmdShowMusic( client );
  136. else
  137. cmdShowMenu( client );
  138. }
  139.  
  140. public cmdShowMusic( client )
  141. {
  142. static title[ 128 ], item[ 128 ], info[ 10 ];
  143. formatex( title, sizeof( title ) - 1, "\y[Music]\d %s Music Menu", menu_action[ client ] ? "Hebrew" : "English");
  144. new menu = menu_create( title, "caseMusic" );
  145.  
  146. if( menu_action[ client ] == ENG_MENU )
  147. for( new i; i < sizeof Eng_Songs_name; i++ ) {
  148. num_to_str( i+1, info, 9 );
  149. formatex( item, sizeof( item ) - 1, "%s", Eng_Songs_name[ i ] );
  150. menu_additem( menu, item, info );
  151. }
  152. else
  153. for( new i; i < sizeof Heb_Songs_name; i++ ) {
  154. num_to_str( i+1, info, 9 );
  155. formatex( item, sizeof( item ) - 1, "%s", Heb_Songs_name[ i ] );
  156. menu_additem( menu, item, info );
  157. }
  158.  
  159.  
  160. menu_setprop( menu, MPROP_EXITNAME, "\yBack" );
  161. menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
  162. menu_display( client, menu, 0 );
  163. }
  164.  
  165. public caseMusic( client, menu, item )
  166. {
  167. if ( item == MENU_EXIT )
  168. {
  169. menu_destroy( menu );
  170. cmdShowMenu( client );
  171. return;
  172. }
  173.  
  174. new name[ 32 ];
  175. get_user_name( client, name, sizeof( name ) - 1 );
  176.  
  177. client_cmd( play_for_all[ client ] ? 0 : client, "mp3 play ^"sound/%s^"", menu_action[ client ] ? Heb_Songs_dir[ item ] : Eng_Songs_dir[ item ] );
  178. ColorChat( play_for_all[ client ] ? 0 : client, "%s^x04%s^x01 now playing^x03 %s^x01 song with^x03 %.1f^x01 Vollume.", play_for_all[ client ] ? "Admin: " : "", name, menu_action[ client ] ? Heb_Songs_name[ item ] : Eng_Songs_name[ item ], Volume[ client ] );
  179. client_cmd( play_for_all[ client ] ? 0 : client, "MP3Volume %.1f", Volume[ client ]);
  180. }
  181.  
  182. stock ColorChat(const id, const string[], {Float, Sql, Resul,_}:...) {
  183. new msg[191], players[32], count = 1;
  184.  
  185. static len;
  186. len = formatex(msg, charsmax(msg), "^x01[^x04 Music^x01 ] " );
  187. vformat(msg[len], charsmax(msg) - len, string, 3);
  188.  
  189. if(id)
  190. players[0] = id;
  191. else
  192. get_players(players,count,"ch");
  193.  
  194. for (new i = 0; i < count; i++)
  195. {
  196. if(is_user_connected(players[i]))
  197. {
  198. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i]);
  199. write_byte(players[i]);
  200. write_string(msg);
  201. message_end();
  202. }
  203. }
  204. return;
  205. }
  206. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  207. *{\\ rtf1\\ fbidis\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ ltrpar\\ lang1037\\ f0\\ fs16 \n\\ par }
  208. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement