Raised This Month: $ Target: $400
 0% 

Fix a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
neogeo
Senior Member
Join Date: Jul 2005
Old 07-07-2008 , 14:55   Fix a plugin
Reply With Quote #1

Hi.
I would like to know if someone can fix this plugin.
With this plugin ,when a player connect on the server it says "hello" ,when you tk a teamfriend it plays a sound and when you hit somebody it plays also a sound.
Thanks for your help.

Code:
#include <amxmodx>
#include <amxmisc>

new const PLUGIN[] = "test1"
new const VERSION[] = "1.0"
new const AUTHOR[] = "test1"

new const g_sounds[][] =    //hello sounds
{
	"misc/1.wav",
	"misc/2.wav",
	"misc/3.wav"
}

new const g_teamattack_sounds[][] =  //tk sounds
{
	"misc/t1.wav",
	"misc/t2.wav",
	"misc/t3.wav",
	"misc/t4.wav"
}

new const g_atac_sounds[][] =  //attack sounds
{        
         "misc/a5.wav",
         "misc/a4.wav",
         "misc/a2.wav",  
         "misc/a3.wav",
         "misc/a6.wav",
         "misc/a7.wav",
         "misc/a8.wav",
         "misc/a1.wav",
         "misc/a65.wav",
         "misc/a62.wav",
         "misc/a64.wav",
         "misc/a63.wav",
         "misc/a61.wav",
         "misc/a45.wav
}

new g_maxplayers

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say elo",   "say_elo_handle")
	register_clcmd("say siema", "say_siema_handle")
	register_clcmd("say siemano",   "say_siemano_handle")
	
	g_maxplayers = get_maxplayers() + 1
}

public plugin_precache()
{   
	for(new i = 0; i < sizeof g_sounds; i++)
	{   
		if(!precache_sound(g_sounds[i]))
		{
			log_amx("* Error: Could not precache (%s), plugin stopped.", 

g_sounds[i])
			pause("ad")
		}
	}
	
	for(new i = 0; i < sizeof g_teamattack_sounds; i++)
	{
		if(!precache_sound(g_teamattack_sounds[i]))
	{
		log_amx("* Error: Could not precache (%s), plugin stopped.", 

g_teamattack_sounds[i])
			pause("ad")
		}     
	}
 
      for(new i = 0; i < sizeof g_atac_sounds; i++)
	{
		if(!precache_sound(g_atac_sounds[i]))
	{
		log_amx("* Error: Could not precache (%s), plugin stopped.", 

g_atack_sounds[i])
		pause("ad")
		}
	}

public say_elo_handle(id)
{
	play_sound(id, 0)
}

public say_siema_handle(id)
{
	play_sound(id, 1)
}

public say_siemano_handle(id)
{
	play_sound(id, 2)
}

public play_sound(id, soundid)
{
	static buffer[64]

	format(buffer, 63, "sound/%s", g_sounds[soundid])

	if(is_user_alive(id))
	{
		for(new i = 0; i < g_maxplayers; i++)
		{
			if(is_user_connected(i))
			{
				console_cmd(id, "spk %s", buffer)
			}
		}
	}
	else
	{
		for(new i = 0; i < g_maxplayers; i++)
		{
			if(is_user_connected(i) && !is_user_alive(i))
			{
				console_cmd(id, "spk %s", buffer)
			}
		}
	}
	return PLUGIN_HANDLED
}

public client_damage(attacker, victim, damage, wpnindex, hitplace, TA,)
{
	if(TA
	{
		emit_sound(victim, CHAN_VOICE, g_teamattack_sounds[random_num(0, sizeof g_teamattack_sounds - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}

public client_damage(attacker, victim, damage, wpnindex, hitplace, ATAC,)
{
	if(ATAC
      { 
		emit_sound(victim, CHAN_VOICE, g_atac_sounds[random_num(0, sizeof g_atac_sounds - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
	}
}
neogeo is offline
Reply



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 13:02.


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