Senior Member
Join Date: Dec 2008
Location: Australia
|
01-15-2011
, 00:58
Music Menu
|
#1
|
Hello, I just made this. Was bored. Thought it'd be a great idea on server's although I can't exactly post it in plugin submission's as you have to edit the code for your own sounds.
Quote:
////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Music Menu //
// This plugin simple add's a menu to the game which play's music once you press the number. //
// //
// Credits : //
// Emps` scripting menu tut @ https://forums.alliedmods.net/showth...6364#BasicMenu //
// //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////
|
register_clcmd("say /music", "music_menu") is telling the menu that the client wants to access it. So you say /menu in game! and a meny will appear.
Quote:
#include <amxmodx>
#include <amxmisc>
public plugin_init() {
register_plugin("Music Menu", "1.1", "eskemo")
register_clcmd("say /music", "music_menu")
register_clcmd("say_team /music", "music_menu")
}
|
Here you need to add the songs names you want with .wav then add them to sound/music/ folder in ur server.
Quote:
public plugin_precache()
{
precache_sound("music/")
precache_sound("music/")
precache_sound("music/")
precache_sound("music/")
precache_sound("music/")
precache_sound("music/")
precache_sound("music/")
}
|
/w simpolise the colour which is white. then you change Song1 to the song name and so on so on so on.
If you want a few less songs. delete that or those menu items.
Quote:
public music_menu(id)
{
new menu = menu_create("\rMusic Menu:", "menu_handler");
menu_additem(menu, "\wSong1", "1", 0);
menu_additem(menu, "\wSong2", "2", 0);
menu_additem(menu, "\wSong3", "3", 0);
menu_additem(menu, "\wSong4", "4", 0);
menu_additem(menu, "\wSong5", "5", 0);
menu_additem(menu, "\wSong6", "6", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
|
Change this "spk music/" to make it have what you put in your precache. Also if you want less items. such as what i said on menu_additem. delete the number that matches it .
Quote:
public menu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 2:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 3:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 4:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 5:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
case 6:
{
client_cmd(0,"spk music/")
client_print(id, print_chat, "Your song has now started playing.");
menu_destroy(menu);
return PLUGIN_HANDLED;
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
|
I know i didn't explain this very well. But i guess you can always ask for more help!
__________________
Free Australian FASTDL Server PM ME
|
|