/*
AMX Mod 0.9.9 by OLO, no warranty, use at your own risk
ver 0.1
steam version,  play sound on player connect
plays audio on connected player
controled by stats menu (scroll to the last positions, so you can turn it off )
and the amx_join_sound cvar (so you can set differend sound on clanwars :D )
also control is overrided by amx_join_snden cvar
if you set amx_join_snden 1  then the sound will be played anyway
so if the cvar is set to 1 but in menu you got it to off it will be played anyway
so to disable it you gotta set the cvar to 0 and the in menu to off
put amx_join_sound to your amx.cfg in example
amx_join_sound "misc/simpsons"
the should should be in sound/misc/simpsons.wav, then
then it will be downloadd form server if someone does not have it
if file does not exist te sound will not be precached but still it can be dwnloaded if added to .res files


you can experiment with in example

amx_join_sound "vox/hello and die"
or
amx_join_sound "vox/may the force be with you"
or
amx_join_sound "vox/please have a good time"

so it will play a sequence of wav files

now imagine, you get some wav prepared, you can amke some nice sentences ....

// changelog
- changed the default sound to vox/hello (was misc/romek)
- added cvar amx_join_snden if stats are inactive (matches)


*/
#include <amxmod>
#include <amxmisc>

public JoinSND 

new snd[32], s[32]
///////////////////////////////////////////////////////////////////////////////
public plugin_precache(){
	get_cvar_string("amx_join_sound",s,31)
	format(snd,31,"sound/%s.wav",s)
	if(file_exists(snd))
	{
		format(snd,31,"%s.wav",s)
		precache_sound(snd)
	}
}

///////////////////////////////////////////////////////////////////////////////
public client_putinserver(id) {
	if(JoinSND || get_cvar_num("amx_join_snden")) set_task(5.0, "play_joinsnd", id)
	return PLUGIN_CONTINUE

}
///////////////////////////////////////////////////////////////////////////////

public play_joinsnd(id)
{
	get_cvar_string("amx_join_sound",s,31)
	format(snd,31,"spk ^"%s^"",s)
	client_cmd(id,snd)

}
///////////////////////////////////////////////////////////////////////////////
public plugin_init() {
	register_plugin("Join Sound","0.2","_KaszpiR_")
	register_cvar("amx_join_sound","vox/hello") //thanks goes to HerrFlik for givimg me this fantastic .wav file :D
	register_cvar("amx_join_snden","1") //0 disable, 1 enable
}
///////////////////////////////////////////////////////////////////////////////
public plugin_cfg(){
//should add to statscfg menu
  new g_addStast[] = "amx_statscfg add ^"%s^" %s"
  server_cmd(g_addStast,"Join Sound","JoinSND") 

}
//end of file
