/***************************************************************************
 * plugin_angrysand_longdeath.sma                          Date: 05/08/2002
 * 
 * Written by Angrysand (angrysand@boneville.net)
 *
 * many thanks to Sank and Eric; i spent quite some time learning this
 * admin-mod scripting stuff from looking at their scripts
 *
 *
 * This Plugin gives admins the ability to longkill a target player, which
 * basically means they get slapped twice every second for 10 seconds, after
 * which they get slay'd.
 **************************************************************************/
 
 
// Access required to b1tchslap
#define ACCESS_LONGDEATH 64
 
// How long the slapping will last
// recommend leaving alone
#define SLAP1_TIME 10
 
 
 
/****************************************************************************/
/************** DO NOT MODIFY CONTENTS BELOW THIS LINE !!! ******************/
/****************************************************************************/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.00";
 
/****************************************************************************/
/************************** Plugin Entry Point ******************************/
/****************************************************************************/
 
public plugin_init() 
{
	plugin_registerinfo("longdeath Plugin", "Yeah, you show'd 'em whos boss!", STRING_VERSION);
	plugin_registercmd("admin_longdeath", "admin_longdeath", ACCESS_LONGDEATH, "admin_longdeath <player>: Slaps the player around and then slays them");
	return PLUGIN_CONTINUE;
}
public admin_longdeath(HLCommand, HLData, HLUserName, UserIndex) 
{
	new Data[MAX_DATA_LENGTH];
	new Text[MAX_TEXT_LENGTH];
	new TargetName[MAX_NAME_LENGTH];
 
	new Red = random(256);
	new Green = random(256);
	new Blue = random(256);
 
	//prep the incoming data/params	
	convert_string(HLData, Data, MAX_DATA_LENGTH);
 
	//get the username
	if (check_user(Data) == 1) {
		get_username(Data,TargetName,MAX_NAME_LENGTH);
 
		snprintf(Text, MAX_TEXT_LENGTH, "%s has been sentenced to DEATH by slapping.", TargetName);
		typesay(Text, 5, Red, Green, Blue);
 
		set_timer("Slap1_Timer", 1, SLAP1_TIME, TargetName);
 
 
	} else {
		selfmessage("Unknown player: ");
		selfmessage(Data);
	}
 
	return PLUGIN_HANDLED;
}
public Slap1_Timer(Timer, Repeat, HLUserName, HLParam) 
{
	new User[MAX_NAME_LENGTH];
 
	convert_string(HLParam, User, MAX_NAME_LENGTH);
	slap(User);
	slap(User);
	if (Repeat-1 == 0)
	{
		slay(User);
	}
}