Raised This Month: $ Target: $400
 0% 

Plugin doesn't precache the sounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 04-09-2011 , 05:48   Plugin doesn't precache the sounds
#1

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_flagsid ) & 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(idmenu0)
}
}
public 
menument(idmenuitem)

if(
item == MENU_EXIT)
{
menu_destroy(menu)
return 
PLUGIN_HANDLED
}

new 
data[6], iName[64], accesscallback;

menu_item_getinfo(menuitemaccessdata,5iName63callback

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_additemzapari"Play the song.""1"); 
menu_additemzapari"\rStop the song.""2"); 

menu_setpropzapariMPROP_EXITMEXIT_ALL ); 
menu_displayidzapari); 


public 
zapar(idzapariitem

if( 
item == MENU_EXIT 

menu_destroyzapari ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfozapariitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additemalarma"Play the song.""1");
menu_additemalarma"\rStop the song.""2");

menu_setpropalarmaMPROP_EXITMEXIT_ALL ); 
menu_displayidalarma); 

public 
alarm(idalarmaitem

if( 
item == MENU_EXIT 

menu_destroyalarma ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfoalarmaitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additemaftermatch"Play the song.""1"); 
menu_additemaftermatch"\rStop the song.""2"); 

menu_setpropaftermatchMPROP_EXITMEXIT_ALL ); 
menu_displayidaftermatch); 


public 
aftm(idaftermatchitem

if( 
item == MENU_EXIT 

menu_destroyaftermatch ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfoaftermatchitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additemyourself"Play the song.""1"); 
menu_additemyourself"\rStop the song.""2"); 

menu_setpropyourselfMPROP_EXITMEXIT_ALL ); 
menu_displayidyourself); 


public 
your(idyourselfitem

if( 
item == MENU_EXIT 

menu_destroyyourself ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfoyourselfitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additembabyhe"Play the song.""1"); 
menu_additembabyhe"\rStop the song.""2"); 

menu_setpropbabyheMPROP_EXITMEXIT_ALL ); 
menu_displayidbabyhe); 


public 
baby(idbabyheitem

if( 
item == MENU_EXIT 

menu_destroybabyhe ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfobabyheitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additemete"Play the song.""1"); 
menu_additemete"\rStop the song.""2"); 

menu_setpropeteMPROP_EXITMEXIT_ALL ); 
menu_displayidete); 


public 
etet(ideteitem

if( 
item == MENU_EXIT 

menu_destroyete ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfoeteitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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_additemenough"Play the song.""1"); 
menu_additemenough"\rStop the song.""2"); 

menu_setpropenoughMPROP_EXITMEXIT_ALL ); 
menu_displayidenough); 


public 
enoh(idenoughitem

if( 
item == MENU_EXIT 

menu_destroyenough ); 
return 
PLUGIN_HANDLED

new 
data[6], iName[64]; 
new 
accesscallback

menu_item_getinfoenoughitemaccessdata,5iName63callback ); 
new 
key str_to_numdata ); 
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 1players[32];
static 
msg191 ];
vformat(msg190input3);
if (
idplayers[0] = id; else get_players(players count "ch"); {
for (new 
0counti++){
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 */ 
Thanks in advance!

Last edited by Arkshine; 04-09-2011 at 07:23.
dreamedward is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode