/*
* Bud-froggy Productions® -- July 26nd, 2001
* Killing Streak Announcer®
*
* Announces Kill streaks
*
* Place in logd_kill
*/
 
#pragma dynamic 16384
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "v2";
 
#define Level1 3
#define Level2 5
#define Level3 7
 
 
#define ACCESS_CONSOLE 131072
#define CLEAN_SLATE 0
 
new FragCount[ MAX_PLAYERS ] = {CLEAN_SLATE,...};
 
playFile( sFileName[ ] ) {
	new Name[ MAX_NAME_LENGTH ];
	new iUserID;
	new iWONID;
	new maxplayers = maxplayercount();
 
	for( new i = 1; i <= maxplayers; i++ ) {
		if( playerinfo(i, Name, MAX_NAME_LENGTH, iUserID, iWONID ) ) {
			playsound(Name, sFileName );
		}
	}
	return 1;
}
 
public logd_killstreak( HLCommand,HLData,HLUserName,UserIndex ) {
	new iIDA;
	new iIDV;
 
	new sID1[3];
	new sID2[3];
	new Data[MAX_DATA_LENGTH];
	new Message[ MAX_TEXT_LENGTH ];
	new Name[MAX_NAME_LENGTH];
 
	convert_string( HLData, Data, MAX_DATA_LENGTH );
	strsplit( Data, " ", sID1, 3, sID2, 3 );
 
	iIDA = strtonum( sID1 );
	iIDV = strtonum( sID2 );
 
	if(!playerinfo(iIDA, Name, MAX_NAME_LENGTH)){
		return PLUGIN_FAILURE;
	}
 
	FragCount[ iIDV ] = CLEAN_SLATE;
	FragCount[ iIDA ] += 1;
 
	if( FragCount[ iIDA ] == Level1 )
	{
		playFile( "misc/multikill.wav" );
		snprintf( Message, MAX_TEXT_LENGTH, "%s: Multi Kill!!!", Name );
		typesay(Message, 6, 255, 255, 255 );
	}
	else if( FragCount[ iIDA ] == Level2 )
	{
		playFile( "misc/ultrakill.wav" );
		snprintf( Message, MAX_TEXT_LENGTH, "%s: Ultra Kill!!!", Name );
		typesay(Message, 6, 255, 10, 255 );
	}
	else if( FragCount[iIDA ] == Level3 )
	{
		playFile( "misc/killingspree.wav" );
		snprintf( Message, MAX_TEXT_LENGTH, "%s is on a Killing Spree!!!", Name );
		typesay(Message, 6, 255, 15, 15 );
	}
 
	return PLUGIN_HANDLED;
}
 
 
public plugin_connect(HLUserName, HLIP, UserIndex) {
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		FragCount[UserIndex] = CLEAN_SLATE;
	}
	return PLUGIN_CONTINUE;
}
 
public plugin_disconnect(HLUserName, UserIndex) {
	if (UserIndex >= 1 && UserIndex <= MAX_PLAYERS) {
		FragCount[UserIndex] = CLEAN_SLATE;
	}
	return PLUGIN_CONTINUE;
}
 
 
 
public plugin_init() {
	plugin_registerinfo("Kill Streak Announcer","Announces kill streaks.",STRING_VERSION);
	plugin_registercmd("logd_killstreak", "logd_killstreak", ACCESS_CONSOLE, "");
 
	exec( "logd_reg 57 admin_command logd_killstreak" );
	return PLUGIN_CONTINUE;
}