/* AMXMOD script.
*
* (c) Copyright 2000-2002, f117bomb
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

public death_msg(id)
{	
	if (get_cvar_num("amx_bulletdistance") == 1) 
	{
		new kIndex = read_data(1)
		new vIndex = read_data(2)
		if (kIndex != vIndex)
		{
			new vName[32], kName[32]
			get_user_name(kIndex,kName,32)
			get_user_name(vIndex,vName,32)
			new vOrigin[3], kOrigin[3]
			get_user_origin(kIndex, kOrigin, 3)
			get_user_origin(vIndex, vOrigin, 3)
			new distance = get_distance(kOrigin,vOrigin)
			new distanceMeter = distance / 42
			new distanceFeet  = distance / 12
			client_print(0,print_chat,"* %s killed %s from a distance of: %ift (%im) ",kName,vName,distanceFeet,distanceMeter )
		}
	}
	return PLUGIN_CONTINUE
}


public plugin_init()
{
	register_plugin("amx_bulletdistance","1.0","f117bomb")
	register_event("DeathMsg","death_msg","a")
	register_cvar("amx_bulletdistance","1")
	return PLUGIN_CONTINUE
}

