Hey guys. I've decided to make a menu for admins. With this menu they could play different songs to the players. Well everything's perfect but the problem is that when I enter the server and choose to play the song if I don't have it in my CS folder, it wont be played. So my question is how can I make it download the songs to the players before they enter the server. Here is the code:
PHP Code:
#include <amxmodx>
#include <fun>
public plugin_init()
{
register_plugin("Play Music", "1.0", "DreamEdward")
register_clcmd("say /playmusic", "show")
register_clcmd("say_team /playmusic", "show")
register_clcmd("say playmusic", "show")
register_clcmd("say_team playmusic", "show")
register_clcmd("say /playmusic", "open")
register_clcmd("say_team /playmusic", "open")
register_clcmd("say playmusic", "open")
register_clcmd("say_team playmusic", "open")
}
public show(id)
{
return PLUGIN_HANDLED_MAIN
}
public plugin_precache()
{
precache_sound("misc/zboyz/z1.mp3")
precache_sound("misc/zboyz/z2.mp3")
precache_sound("misc/zboyz/z3.mp3")
precache_sound("misc/zboyz/z4.mp3")
precache_sound("misc/zboyz/z5.mp3")
precache_sound("misc/zboyz/z6.mp3")
precache_sound("misc/zboyz/z7.mp3")
}
public open(id)
{
if( get_user_flags( id ) & ADMIN_LEVEL_B )
{
new menu = menu_create("Music Menu:", "menument")
menu_additem(menu, "Galena - Za Pari", "1", 0)
menu_additem(menu, "Galena - Alarma", "2", 0)
menu_additem(menu, "Escape the Fate - The Aftermatch", "3", 0)
menu_additem(menu, "Eminem - Lose Yourself", "4", 0)
menu_additem(menu, "T-Pain ft, Pitbull - Hey Baby", "5", 0)
menu_additem(menu, "Katy Perry ft. Kayne West - E.T", "6", 0)
menu_additem(menu, "The Black Eyed Peas - Just can't get enough", "7", 0)
menu_display(id, menu, 0)
}
}
public menument(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64], access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
zapari(id)
}
case 2:
{
alarma(id)
}
case 3:
{
aftermatch(id)
}
case 4:
{
yourself(id)
}
case 5:
{
babyhe(id)
}
case 6:
{
ete(id)
}
case 7:
{
enough(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED_MAIN
}
public zapari(id)
{
new zapari = menu_create( "Galena - Za pari:", "zapar" );
menu_additem( zapari, "Play the song.", "1", 0 );
menu_additem( zapari, "\rStop the song.", "2", 0 );
menu_setprop( zapari, MPROP_EXIT, MEXIT_ALL );
menu_display( id, zapari, 0 );
}
public zapar(id, zapari, item)
{
if( item == MENU_EXIT )
{
menu_destroy( zapari );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( zapari, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z1.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3GALENA - ZA PARI^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public alarma(id)
{
new alarma = menu_create( "Galena - Alarma:", "alarm" );
menu_additem( alarma, "Play the song.", "1", 0 );
menu_additem( alarma, "\rStop the song.", "2", 0 );
menu_setprop( alarma, MPROP_EXIT, MEXIT_ALL );
menu_display( id, alarma, 0 );
}
public alarm(id, alarma, item)
{
if( item == MENU_EXIT )
{
menu_destroy( alarma );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( alarma, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z2.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3GALENA - ALARMA^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public aftermatch(id)
{
new aftermatch = menu_create( "Escape the Fate - The Aftermatch:", "aftm" );
menu_additem( aftermatch, "Play the song.", "1", 0 );
menu_additem( aftermatch, "\rStop the song.", "2", 0 );
menu_setprop( aftermatch, MPROP_EXIT, MEXIT_ALL );
menu_display( id, aftermatch, 0 );
}
public aftm(id, aftermatch, item)
{
if( item == MENU_EXIT )
{
menu_destroy( aftermatch );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( aftermatch, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z3.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3Escape the Fate - The Aftermatch^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public yourself(id)
{
new yourself = menu_create( "Eminem - Lose Yourself:", "your" );
menu_additem( yourself, "Play the song.", "1", 0 );
menu_additem( yourself, "\rStop the song.", "2", 0 );
menu_setprop( yourself, MPROP_EXIT, MEXIT_ALL );
menu_display( id, yourself, 0 );
}
public your(id, yourself, item)
{
if( item == MENU_EXIT )
{
menu_destroy( yourself );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( yourself, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z4.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3Eminem - Lose Yourself^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public babyhe(id)
{
new babyhe = menu_create( "T-Pain ft, Pitbull - Hey Baby:", "baby" );
menu_additem( babyhe, "Play the song.", "1", 0 );
menu_additem( babyhe, "\rStop the song.", "2", 0 );
menu_setprop( babyhe, MPROP_EXIT, MEXIT_ALL );
menu_display( id, babyhe, 0 );
}
public baby(id, babyhe, item)
{
if( item == MENU_EXIT )
{
menu_destroy( babyhe );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( babyhe, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z5.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3T-Pain ft, Pitbull - Hey Baby^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public ete(id)
{
new ete = menu_create( "Katy Perry ft. Kayne West - E.T:", "etet" );
menu_additem( ete, "Play the song.", "1", 0 );
menu_additem( ete, "\rStop the song.", "2", 0 );
menu_setprop( ete, MPROP_EXIT, MEXIT_ALL );
menu_display( id, ete, 0 );
}
public etet(id, ete, item)
{
if( item == MENU_EXIT )
{
menu_destroy( ete );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( ete, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z6.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3Katy Perry ft. Kayne West - E.T^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
public enough(id)
{
new enough = menu_create( "The Black Eyed Peas - Just can't get enough:", "enoh" );
menu_additem( enough, "Play the song.", "1", 0 );
menu_additem( enough, "\rStop the song.", "2", 0 );
menu_setprop( enough, MPROP_EXIT, MEXIT_ALL );
menu_display( id, enough, 0 );
}
public enoh(id, enough, item)
{
if( item == MENU_EXIT )
{
menu_destroy( enough );
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo( enough, item, access, data,5, iName, 63, callback );
new key = str_to_num( data );
switch( key )
{
case 1:
{
client_cmd(0,"mp3 play sound/misc/zboyz/z7.mp3")
ColorMessage(0, "^4[MUSIC]^1 We're now playing ^3The Black Eyed Peas - Just can't get enough^1.");
}
case 2:
{
client_cmd(0, "mp3 stop")
client_cmd(0, "stopsound")
ColorMessage(0, "^4[MUSIC]^1 Music has been ^3stopped^1!");
}
}
return PLUGIN_HANDLED;
}
/*START - ColorChat */
stock ColorMessage(const id, const input[], any:...){
new count = 1, players[32];
static msg[ 191 ];
vformat(msg, 190, input, 3);
if (id) players[0] = id; else get_players(players , count , "ch"); {
for (new i = 0; i < count; i++){
if (is_user_connected(players[i])){
message_begin(MSG_ONE_UNRELIABLE , get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();}}}
}
/*END - ColorChat */