Raised This Month: $ Target: $400
 0% 

Reproduce sound every third murder.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Sutar
Senior Member
Join Date: Sep 2010
Old 08-22-2012 , 10:33   Reproduce sound every third murder.
Reply With Quote #1

Here there is a plugin (I wrote myself) it reproduces sounds: multikill, megakill and other.

For example:
I killed 3 players and play sound multikill.
I killed 3 more players and play sound megakill.
I killed 3 more players and play sound ultrakill.
I killed 3 more players and play sound godlike.

But the problem is that if I killed 3 players, and then a further 3 plays sound godlike. ie passes 2 audio, megakill and ultrakill.

What's the problem?

Code:
#include <amxmodx>
#include <csx>
#include <cstrike>

new g_streakKills[33][1]

new g_Sounds[10][] =
{
	"multikill",
	"megakill",
	"ultrakill",
	"godlike",
	"rampage", 
	"wickedsick",
	"killingspree",
	"unstoppable",
	"monsterkill",
	"ludacrisskill"
}

public plugin_init()
{
	register_plugin("Music Stats", "2.0", "Sutar")
}

public client_putinserver(id)
	g_streakKills[id] = {0}

public client_death(killer, victim, wpnindex, hitplace, TK)
{
	if(wpnindex == CSW_C4)
		return

	new headshot = (hitplace == HIT_HEAD) ? 1 : 0;
	new selfkill = (killer == victim) ? 1 : 0;

	if(!TK && !selfkill && killer)
	{
		g_streakKills[victim][0] = 0;
		g_streakKills[killer][0] += 1;
		
		new a = g_streakKills[killer][0] - 3;
		
		if((a > -1) && !(a % 3))
		{
			if(a > 9)
				a = 5;
			
			new file[32]
			format(file, 31, "misc/%s", g_Sounds[a])
			play_sound(file)
			return
		}
	}

	return
}

public play_sound(sound[])
{
	new players[32], pnum
	get_players(players, pnum, "c")

	for(new i = 0; i < pnum; i++)
	{
		if(is_user_connecting(players[i]))
			continue
		
		client_cmd(players[i], "spk %s", sound)
	}
}
Sutar is offline
 


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 05:52.


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