mirror of
https://github.com/EpicMorgVault/AMXx-Media-Player.git
synced 2024-12-26 04:55:28 +03:00
Ver 1.1.2
This commit is contained in:
parent
03d587179f
commit
6c660c7968
25
amxmodx/data/lang/amx_show_playlist.txt
Normal file
25
amxmodx/data/lang/amx_show_playlist.txt
Normal file
@ -0,0 +1,25 @@
|
||||
[en]
|
||||
PREV = Prev
|
||||
NEXT = Next
|
||||
EXIT = Exit
|
||||
MSG1 = Stops currently playing sounds/music.
|
||||
MSG2 = Songs in server playlist:
|
||||
MSG3 = mp3 stop;stopsound
|
||||
MSG4 = Admin Turned The Music Off.
|
||||
MSG5 = More than one file contains that phrase in it.
|
||||
MSG6 = No file containing that phrase was found
|
||||
MSG7 = mp3 stop;stopsound
|
||||
MSG8 = Music stopped
|
||||
|
||||
[ru]
|
||||
PREV = Ñëåä
|
||||
NEXT = Ïðåä
|
||||
EXIT = Âûõîä
|
||||
MSG1 = Îñòàíîâëåí òåêóùèé òðåê
|
||||
MSG2 = Ïåñíè â playlist:
|
||||
MSG3 = mp3 stop;stopsound
|
||||
MSG4 = Àäìèí âûêëþ÷èë ìóçûêó
|
||||
MSG5 = Íàäåíî áîëåå îäíîãî òðåêà ïî ôðàçå
|
||||
MSG6 = Íå íàéäåò òðåê ïî ôðàçå
|
||||
MSG7 = mp3 stop;stopsound
|
||||
MSG8 = Îñòàíîâëåí òðåê
|
@ -2,25 +2,31 @@
|
||||
#include <amxmisc>
|
||||
|
||||
#define PLUGIN "AMX Media Player"
|
||||
#define VERSION "1.1.1"
|
||||
#define VERSION "1.1.2"
|
||||
#define AUTHOR "AurZum (EpicMorg)"
|
||||
|
||||
#define MAX_SONGS 10 //set number of songs you want, default 10
|
||||
#define MAX_SONGS 10 //set number of songs you want, default 10
|
||||
#define SIZE_CONFIG_DIR 200
|
||||
#define SIZE_SONG_DIR 256
|
||||
|
||||
new configsdir[200]
|
||||
new configfile[200]
|
||||
new song[MAX_SONGS][256]
|
||||
new songdir[MAX_SONGS][256]
|
||||
new configsdir[SIZE_CONFIG_DIR]
|
||||
new configfile[SIZE_CONFIG_DIR]
|
||||
new song[MAX_SONGS][SIZE_SONG_DIR]
|
||||
new songdir[MAX_SONGS][SIZE_SONG_DIR]
|
||||
new bool:precached[MAX_SONGS]
|
||||
new indexs[MAX_SONGS]
|
||||
|
||||
public plugin_init() {
|
||||
register_plugin(PLUGIN, VERSION, AUTHOR)
|
||||
register_clcmd("amx_show_playlist", "show_palylist_menu", ADMIN_LEVEL_E, "");
|
||||
register_concmd("amx_play","cmd_play",ADMIN_LEVEL_E," <Part Of Filename> ")
|
||||
register_concmd("amx_playlist","cmd_playlist",ADMIN_LEVEL_E," Displays a list of songs in the server playlist. ")
|
||||
register_concmd("amx_stopplay","cmd_stop",ADMIN_LEVEL_E," Stops currently playing sounds/music. ")
|
||||
register_clcmd("say /stop","cl_cmd_stop")
|
||||
register_plugin(PLUGIN, VERSION, AUTHOR);
|
||||
register_dictionary("amx_show_playlist.txt");
|
||||
register_clcmd("amx_show_playlist", "show_palylist_menu", ADMIN_LEVEL_E, "");
|
||||
//register_concmd("amx_play","cmd_play",ADMIN_LEVEL_E," <Part Of Filename> ")
|
||||
//register_concmd("amx_playlist","cmd_playlist",ADMIN_LEVEL_E," Displays a list of songs in the server playlist. ")
|
||||
|
||||
new line[64];
|
||||
formatex(line, charsmax(line), "%L", "MSG1");
|
||||
register_concmd("amx_stopplay","cmd_stop",ADMIN_LEVEL_E,line);
|
||||
register_clcmd("say /stop","cl_cmd_stop");
|
||||
|
||||
}
|
||||
|
||||
@ -38,9 +44,9 @@ public show_palylist_menu(id, lvl, cid) {
|
||||
|
||||
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
|
||||
menu_setprop(menu, MPROP_PERPAGE, 7);
|
||||
menu_setprop(menu, MPROP_BACKNAME, "Prev");
|
||||
menu_setprop(menu, MPROP_NEXTNAME, "Next");
|
||||
menu_setprop(menu, MPROP_EXITNAME, "Exit");
|
||||
menu_setprop(menu, MPROP_BACKNAME, "%L", "PREV");
|
||||
menu_setprop(menu, MPROP_NEXTNAME, "%L", "NEXT");
|
||||
menu_setprop(menu, MPROP_EXITNAME, "%L", "EXIT");
|
||||
menu_setprop(menu, MPROP_NUMBER_COLOR, "\w");
|
||||
|
||||
menu_display(id, menu, 0);
|
||||
@ -56,10 +62,10 @@ public mh_MyMenu(id, menu, item) {
|
||||
|
||||
new command[6], name[64], access, callback;
|
||||
|
||||
menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
|
||||
menu_item_getinfo(menu, item, access, command, charsmax(command), name, charsmax(name), callback);
|
||||
|
||||
new commandline[128];
|
||||
format(commandline,sizeof(commandline),"amx_play %s",song[indexs[item]]);
|
||||
format(commandline,charsmax(commandline),"amx_play %s",song[indexs[item]]);
|
||||
client_cmd(id,commandline);
|
||||
|
||||
menu_destroy(menu);
|
||||
@ -69,15 +75,15 @@ public mh_MyMenu(id, menu, item) {
|
||||
|
||||
public plugin_precache() {
|
||||
new songdir2[64];
|
||||
get_configsdir(configsdir,sizeof(configsdir));
|
||||
format(configfile,sizeof(configfile),"%s/mediaplayer_music.ini",configsdir);
|
||||
get_configsdir(configsdir,charsmax(configsdir));
|
||||
formatex(configfile,charsmax(configfile),"%s/mediaplayer_music.ini",configsdir);
|
||||
new trash, index;
|
||||
for(new i=0;i<MAX_SONGS;i++) {
|
||||
precached[i]=false;
|
||||
read_file(configfile,i,song[i],63,trash);
|
||||
read_file(configfile,i,song[i],SIZE_SONG_DIR - 1,trash);
|
||||
if(!equali(song[i][4],"")) {
|
||||
format(songdir[i],63,"music/mediaplayer/%s",song[i]);
|
||||
format(songdir2,63,"sound/music/mediaplayer/%s",song[i]);
|
||||
format(songdir[i],SIZE_SONG_DIR - 1,"music/mediaplayer/%s",song[i]);
|
||||
format(songdir2,charsmax(songdir2),"sound/music/mediaplayer/%s",song[i]);
|
||||
if(file_exists(songdir2)) {
|
||||
precached[i]=true
|
||||
precache_sound(songdir[i])
|
||||
@ -89,7 +95,7 @@ public plugin_precache() {
|
||||
}
|
||||
|
||||
public cmd_playlist(id,level,cid) {
|
||||
console_print(id,"Songs in server playlist:")
|
||||
console_print(id,"%L","MSG2")
|
||||
for(new i=0;i<MAX_SONGS;i++) {
|
||||
if(precached[i]) {
|
||||
console_print(id,song[i])
|
||||
@ -102,8 +108,8 @@ public cmd_stop(id,level,cid) {
|
||||
if (!cmd_access(id,level,cid,1)) {
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
client_cmd(0,"mp3 stop;stopsound")
|
||||
client_print(0,print_chat,"Admin Turned The Music Off.")
|
||||
client_cmd(0,"%L", "MSG3");
|
||||
client_print(0,print_chat,"%L","MSG4")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
@ -113,19 +119,19 @@ public cmd_play(id,level,cid) {
|
||||
}
|
||||
client_print(id,print_chat,"cmd_play","");
|
||||
new arg1[32]
|
||||
read_argv(1,arg1,31)
|
||||
read_argv(1,arg1,charsmax(arg1))
|
||||
new songnum = MAX_SONGS
|
||||
for(new i=0;i<MAX_SONGS;i++) {
|
||||
if(precached[i] && containi(song[i],arg1)!=-1) {
|
||||
if(songnum!=MAX_SONGS) {
|
||||
console_print(id,"More than one file contains that phrase in it.")
|
||||
console_print(id,"%L","MSG5")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
songnum = i
|
||||
}
|
||||
}
|
||||
if(songnum==MAX_SONGS) {
|
||||
console_print(id,"No file containing that phrase was found. Type amx_playlist to see songlist.")
|
||||
console_print(id,"%L","MSG6")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
if(containi(song[songnum],".mp3")) {
|
||||
@ -139,7 +145,7 @@ public cmd_play(id,level,cid) {
|
||||
}
|
||||
|
||||
public cl_cmd_stop(id) {
|
||||
client_cmd(id,"mp3 stop;stopsound")
|
||||
client_print(id,print_chat,"Music stopped")
|
||||
client_cmd(id,"%L","MSG7")
|
||||
client_print(id,print_chat,"%L","MSG8")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user