amx_roundsound - Nieoficjalny polski support AMX Mod XEnd Round Sounds - AlliedModders--------------------------------------------------------------------------------
Do pliku roundsound.ini w addons/amxmodx/configs dopisujesz samą nazwę nuty
Muzyka ma się znajdować w sound/misc
Ścieżke można edytować w kodzie.
Plugin wyświetla także na ekranie nazwę piosenki (czy to co wpisaliśmy w roundsound.ini)
#include <amxmodx>
#include <amxmisc>
new gFiles[300][128]
new gCount=0
public plugin_init() 
{ 
	register_plugin("RoundSound","2.0","PaintLancer")
	register_event("SendAudio", "win", "a", "2&%!MRAD_terwin")
	register_event("SendAudio", "win", "a", "2&%!MRAD_ctwin")  
}
public win()
{
	if(gCount>0)
	{
		new rand = random_num(0,gCount-1)
		client_cmd(0,"stopsound")
		set_hudmessage(255, 0, 0, 0.11, 0.11, 0, 6.0, 12.0)
		show_hudmessage(0, "%s",gFiles[rand])
		
		play_any_sound(gFiles[rand])
	}
	return PLUGIN_HANDLED
}
public plugin_precache() 
{
	new rsFile[128],s[128],i
  	get_configsdir(rsFile,128)
	add(rsFile,128,"/roundsound.ini")
	i=fopen(rsFile,"rt")
	gCount=0
	if(i==0){
		set_hudmessage(255, 0, 0, -1.0, 0.89, 0, 2.0, 20.0,0.1,0.1,-1)
		show_hudmessage(0,"Error rs loading config file!")
	} else {
		while (!feof(i)) // Reading rs config from roundsound.ini 
		{
			fgets(i,s,128)
			if (s[strlen(s)-1] == '^n')
			{
				s[strlen(s)-1] = 0
			}
			copy(gFiles[gCount],128,s)
			gCount++
		}
		fclose(i)
	}
	for(i=0;i<gCount;i++)
	{
		format(s,128,"sound/misc/%s",gFiles[i])
		precache_generic(s)
	}
	return PLUGIN_CONTINUE
}
public play_any_sound(sound[])
{
   new is_mpeg = ( containi(sound, ".mp") != -1 )
   if ( is_mpeg )
      client_cmd(0, "mp3 play ^"sound/misc/%s^"", sound)
   else
      client_cmd(0, "spk ^"%s^"", sound)
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
Tutaj jeszcze inna wersja:
#include <amxmodx> 
new const sounds_ct[][] = {"sound/misc/muza1.mp3","sound/misc/muza2.mp3","sound/misc/muza3.mp3","sound/misc/muza4.mp3","sound/misc/muza5.mp3"}
new const sounds_terro[][] = {"sound/misc//muza6.mp3","sound/misc//muza7.mp3","sound/misc//muza8.mp3","sound/misc//muza9.mp3","sound/misc/muza10.mp3"}
public plugin_init() 
{ 
  register_plugin("RoundSoundy","1","Sal") 
  register_event("SendAudio", "ct", "a", "2&%!MRAD_ctwin") 
  register_event("SendAudio", "terro", "a", "2&%!MRAD_terwin") 
} 
public plugin_precache() 
{ 
  new i 
  for(i = 0; i < sizeof sounds_ct; i++) 
  precache_generic(sounds_ct[i]) 
  new u 
  for(u = 0; u < sizeof sounds_terro; u++) 
  precache_generic(sounds_terro[u]) 
} 
public ct() 
{ 
  client_cmd(0,"stopsound") 
  client_cmd(0, "mp3 stop") 
  client_cmd(0, "mp3 play %s", sounds_ct[random_num(0, charsmax(sounds_ct))] ) 
} 
public terro() 
{ 
  client_cmd(0,"stopsound") 
  client_cmd(0, "mp3 stop") 
  client_cmd(0, "mp3 play %s", sounds_terro[random_num(0, charsmax(sounds_terro))] ) 
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
					
					
					
							Użytkownik Abes Mapper edytował ten post 30.01.2011 13:55