RSSy MYGO.pl Opublikowano Czerwiec 7, 2022 o 08:43 RSSy Udostępnij Opublikowano Czerwiec 7, 2022 o 08:43 So this music menu plugin works great but I would like to create a "music.ini" file from which to load the new songs so I don't have to modify and compile every time I want to upload a new song. Thanks! PHP Code: #include <amxmodx> #define PLUGIN "Random Sounds by Command and Menu" #define VERSION "1.4" #define AUTHOR "[N]drs" enum _:DATA { NAME[20], RUTA[126] } new const SONIDO[][DATA] = { {"Toto - Africa", "sound/music/africa.mp3"}, {"Korn - Thoughless", "sound/music/thoughtless.mp3"} } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /play", "play") register_clcmd("say /music", "play_menu") register_clcmd("say /stop", "stop_sound") } public plugin_precache() { for(new i; i < sizeof(SONIDO); i++) precache_generic(SONIDO[i][RUTA]) } public play(id) { if(get_user_flags(id) & ADMIN_LEVEL_H) { new i = random_num(0, sizeof(SONIDO)) play_sound(id, i) } return PLUGIN_HANDLED } public play_menu(id) { if(~get_user_flags(id) & ADMIN_LEVEL_H) return PLUGIN_HANDLED new iMenu = menu_create("\yMusic Menu", "handlerMenu") for(new i; i < sizeof(SONIDO); i++) menu_additem(iMenu, SONIDO[i][NAME]) menu_display(id, iMenu) return PLUGIN_HANDLED } public handlerMenu(id, iMenu, item) { if(item == MENU_EXIT) { menu_destroy(iMenu) return PLUGIN_HANDLED } play_sound(id, item) menu_destroy(iMenu) return PLUGIN_HANDLED } play_sound(id, const iSound) { client_cmd(0, "Mp3 play %s", SONIDO[iSound][RUTA]) client_print_color(id, print_team_grey, "^3ADMIN ^4%n ^3has changed the song to ^4%s", id, SONIDO[iSound][NAME]) } public stop_sound(id) { client_cmd(0, "Mp3 stop") Przeczytaj cały wpis Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi