/*
* Bud-froggy Productions® -- July 26nd, 2001
* axe Kill Announcer®
*
* Announces Axe fragging
*
* Place in logd_kill
*/
 
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
#define ACCESS_CONSOLE 131072
 
new STRING_VERSION[MAX_DATA_LENGTH] = "v1";
 
public logd_axekill(HLCommand,HLData,HLUserName,UserIndex) {
	new sID1[MAX_NUMBER_LENGTH];
	new sID2[MAX_NUMBER_LENGTH];
 
	new Weapon[MAX_NAME_LENGTH];
	new Data[MAX_DATA_LENGTH];
 
	convert_string(HLData, Data, MAX_DATA_LENGTH);
	strsplit(Data, " ", sID1, MAX_NUMBER_LENGTH, sID2, MAX_NUMBER_LENGTH, Weapon, MAX_NAME_LENGTH);
 
	if( strcmp( Weapon, "axe") == 0 ) {
		new Message[MAX_TEXT_LENGTH];
		new NameA[MAX_NAME_LENGTH];
		new NameV[MAX_NAME_LENGTH];
 
		new iRand = random(9);
		new iID1 = strtonum(sID1);
		new iID2 = strtonum(sID2);
 
		if( !playerinfo(iID1,NameA,MAX_NAME_LENGTH) ) {
			return PLUGIN_FAILURE;
		}
		if( !playerinfo(iID2,NameV,MAX_NAME_LENGTH) ) {
			return PLUGIN_FAILURE;
		}
 
		switch( iRand ) {
			case 0:		//we need braces inside the switch statements for some reason
			{		//if soneone figures out why, tell me please!!! :)
				snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a axe!!!", NameA, NameV );
				printMessage( Message );
			}
			case 1:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s, you were just n00b-ized by %s", NameV, NameA );
				printMessage( Message );
			}
			case 2:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s, you should consider changing pastimes.^nI'd recommend either gardening or under water basket weaving.", NameV );
				printMessage( Message );
			}
			case 3:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a axe!!!", NameA, NameV );
				printMessage( Message );
			}
			case 4:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s got sLiCeD and DiCeD by %s", NameV, NameA );
				printMessage( Message );
			}
			case 5:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "Axe Kill by %s^nOoga Shaka!!!", NameA);
				printMessage( Message );
			}
			case 6:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s is now ground beef.", NameV );
				printMessage( Message );
			}
			case 7:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s, the other white meat.", NameV );
				printMessage( Message );
			}
			case 8:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s, have you no honor?", NameV );
				printMessage( Message );
			}
			default:
			{
				snprintf( Message, MAX_TEXT_LENGTH, "%s oWneD %s with a axe!!!", NameA, NameV );
				printMessage( Message );
			}
		}
	}
	return PLUGIN_HANDLED;
}
 
printMessage( Message[ ] ) {
	new iRandRed = random( 3 );
	new iRandGreen = random( 3 );
	new iRandBlue = random( 3 );
 
	new iRandSayType = random( 2 );
 
	switch( iRandRed ) {
		case 0:	iRandRed = 10;
		case 1:	iRandRed = 150;
		case 2:	iRandRed = 255;
	}
 
	switch( iRandGreen ) {
		case 0:	iRandGreen = 10;
		case 1:	iRandGreen = 150;
		case 2:	iRandGreen = 255;
	}
 
	switch( iRandBlue ) {
		case 0:	iRandBlue = 10;
		case 1:	iRandBlue = 150;
		case 2:	iRandBlue = 255;
	}
 
	if( iRandSayType )
		centersay( Message, 12, iRandRed, iRandGreen, iRandBlue );
	else typesay( Message, 6, iRandRed, iRandGreen, iRandBlue );
 
	return 1;
}
 
public plugin_init() {
	plugin_registerinfo("axe Kill Announcer","Throws a random center/typesay when someone gets axed.",STRING_VERSION);
  	plugin_registercmd("logd_axekill", "logd_axekill", ACCESS_CONSOLE, "");
 
	exec( "logd_reg 57 admin_command logd_axekill" );
	return PLUGIN_CONTINUE;
}