Raised This Month: $ Target: $400
 0% 

Sounds Won't Play


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 08-06-2009 , 05:43   Sounds Won't Play
Reply With Quote #1

I Made zp Class Hunter Emmited the Sounds Miss Hit Die Leap But Works Only Leap Can Somebody help Pls

Code:
#include <amxmodx>
#include <fakemeta>
#include <Left4Deadplague>
#include <hamsandwich>

#define PLUGIN "[ZP]Class: Hunter"
#define VERSION "1.0"
#define AUTHOR "DoviuX"

new const zclass_name[] = { "Hunter" }
new const zclass_info[] = { "Can Leap" }
new const zclass_model[] = { "Hunter" }
new const zclass_clawmodel[] = { "v_Hunter_knife.mdl" }
const zclass_health = 200
const zclass_speed = 300
const Float:zclass_gravity = 0.8
const Float:zclass_knockback = 3.0

new g_zombie[33]

new g_sndleap[] = "Left4Dead/Hunter_Leap.wav"

new const g_sound_miss[][] =
{ 	
	"Left4Dead/Hunter_miss1.wav", 
	"Left4Dead/Hunter_miss2.wav",
	"Left4Dead/Hunter_miss3.wav" 
}

new const g_sound_hit[][] = 
{ 
	"Left4Dead/Hunter_strike1.wav",
	"Left4Dead/Hunter_strike2.wav",
	"Left4Dead/Hunter_strike3.wav"  
}
new const g_sound_pain[][] =
{
	"Left4Dead/Hunter_pain1.wav",
	"Left4Dead/Hunter_pain2.wav",
	"Left4Dead/Hunter_pain3.wav"
}

new const g_sound_die[][] =
{
	"Left4Dead/Hunter_die1.wav",
	"Left4Dead/Hunter_die2.wav"
}

new g_zclass_LongJump, g_LongJump_force, g_LongJump_height, cvar_cooldown
new Float:g_lastleaptime[33] // time leap was last used

public plugin_init()
{
	register_cvar("zp_zclass_leap_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
	
	g_LongJump_force = register_cvar("zp_zclass_leap_force", "600")
	g_LongJump_height = register_cvar("zp_zclass_leap_height", "245")
	cvar_cooldown = register_cvar("zp_leap_cooldown", "1.5")
	
	register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
	register_forward(FM_EmitSound,				"fw_EmitSound")
}

public plugin_precache()
{
	g_zclass_LongJump = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)

	precache_sound(g_sndleap)

	new iNum
	for (iNum = 0; iNum < sizeof g_sound_miss; iNum++)
		engfunc(EngFunc_PrecacheSound, g_sound_miss[iNum])
	for (iNum = 0; iNum < sizeof g_sound_hit; iNum++)
		engfunc(EngFunc_PrecacheSound, g_sound_hit[iNum])
	for (iNum = 0; iNum < sizeof g_sound_pain; iNum++)
		engfunc(EngFunc_PrecacheSound, g_sound_pain[iNum])
	for (iNum = 0; iNum < sizeof g_sound_die; iNum++)
		engfunc(EngFunc_PrecacheSound, g_sound_die[iNum])
}

public zp_user_infected_post(player, infector)
{
	if (zp_get_user_zombie_class(player) == g_zclass_LongJump)
	{
		client_print(player, print_chat, "[L4D] You're Now A Hunter !")	
	}
	return PLUGIN_CONTINUE
}

public fw_PlayerPreThink(id)
{
	if (!is_user_alive(id))
		return
		
	if (allowed_LongJump(id))
	{
		static Float:velocity[3]
		velocity_by_aim(id, get_pcvar_num(g_LongJump_force), velocity)
		
		velocity[2] = get_pcvar_float(g_LongJump_height)
		
		set_pev(id, pev_velocity, velocity)

		// Set the current leap time
		g_lastleaptime[id] = get_gametime()
	}
}

public fw_EmitSound(id, channel, sample[], Float:volume, Float:attn, flag, pitch)
{
	if(!is_user_connected(id) || !g_zombie[id])
		return FMRES_IGNORED
		
	//KNIFE
	if (sample[0] == 'w' && sample[1] == 'e' && sample[8] == 'k' && sample[9] == 'n')
	{
		switch(sample[17])
		{
			case 'l': 
				return FMRES_SUPERCEDE
				
			case 's', 'w':
			{
				emit_sound(id, CHAN_WEAPON, g_sound_miss[random(sizeof g_sound_miss)], volume, attn, flag, pitch)
				return FMRES_SUPERCEDE
			}
			
			case 'b', '1', '2', '3', '4':
			{
				emit_sound(id, CHAN_WEAPON, g_sound_hit[random(sizeof g_sound_hit)], volume, attn, flag, pitch)
				return FMRES_SUPERCEDE
			}
		}
	}
	//PAIN
	else if (sample[1] == 'l' && sample[2] == 'a' && sample[3] == 'y' && ( (containi(sample, "bhit") != -1) || (containi(sample, "pain") != -1) || (containi(sample, "shot") != -1)))
	{
		emit_sound(id, CHAN_VOICE, g_sound_pain[random(sizeof g_sound_pain)], volume, attn, flag, pitch)
		return FMRES_SUPERCEDE
	}		
	//DEATH
	else if (sample[7] == 'd' && (sample[8] == 'i' && sample[9] == 'e' || sample[12] == '6'))
	{
		emit_sound(id, CHAN_VOICE, g_sound_die[random(sizeof g_sound_die)], volume, attn, flag, pitch)
		return FMRES_SUPERCEDE
	}
	return FMRES_IGNORED	
}

allowed_LongJump(id)
{	
	if (!zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
		return false

	if (zp_get_user_zombie_class(id) != g_zclass_LongJump)
		return false
		 
	if (!((pev(id, pev_flags) & FL_ONGROUND) && (pev(id, pev_flags) & FL_DUCKING)) || fm_get_speed(id) < 10)
		return false
	
	static buttons
	buttons = pev(id, pev_button)
	
	// Not doing a longjump (added bot support)
	if (!(buttons & IN_ATTACK) && !is_user_bot(id))
		return false

	// Get cooldown cvar
	emit_sound(id, CHAN_VOICE, g_sndleap, 1.0, ATTN_NORM, 0, PITCH_HIGH)
	static Float:cooldown
	cooldown = get_pcvar_float(cvar_cooldown)

	// Cooldown not over yet
	if (get_gametime() - g_lastleaptime[id] < cooldown)
		return false
		
	return true
}

stock fm_get_speed(entity)
{
	static Float:velocity[3]
	pev(entity, pev_velocity, velocity)
	
	return floatround(vector_length(velocity));
}
DoviuX is offline
Send a message via Skype™ to DoviuX
 


Thread Tools
Display Modes

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 18:18.


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