As to why it says it 5 times, Im not sure, but my first stab at it would be that the attack is repeated 4 times during its life time? Like if you strike at a wall with some one behind you, and you turn quickly enough, it will catch them too.
EDIT: Found out what it is. It's when you hold the button down it keeps repeating.
I don't know how to fix that yet, but I fixed a few other things.
Code:
#include <amxmodx>
#include <fakemeta>
#include <tsfun>
#define PLUGIN "Brass Knuckles"
#define VERSION "1.0"
#define AUTHOR "Calimaw/stupok69"
new bool:g_brassknuckles[33]
new bool:g_is_in_kungfu[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("WeaponInfo"), "WeaponInfo_function")
/////////////////////////
register_event("DeathMsg", "Event_Death", "a")
/////////////////////////
register_forward(FM_PlayerPreThink, "PlayerPreThink")
register_clcmd("say /brassknuckles", "cmdBrassKnuckles")
}
public client_connect(id)
{
g_brassknuckles[id] = false
g_is_in_kungfu[id] = true
}
public Event_Death()
{
new id = read_data(2)
g_brassknuckles[id] = false
g_is_in_kungfu[id] = true
}
public WeaponInfo_function(msg_id, msg_dest, msg_entity)
{
if(!get_msg_arg_int(1))
{
g_is_in_kungfu[msg_dest] = true
}
else
{
g_is_in_kungfu[msg_dest] = false
}
}
public cmdBrassKnuckles(id)
{
if(!is_user_alive(id))
client_print(id, print_chat, "The dead cannot buy items!")
else if(g_brassknuckles[id])
client_print(id, print_chat, "What good would that do?")
else
{
g_brassknuckles[id] = true
client_print(id, print_chat, "You bought a pair of brass knuckles!")
}
return PLUGIN_HANDLED
}
public PlayerPreThink(id)
{
if(!is_user_alive(id))
return FMRES_IGNORED
///////////////////////////
else if(!g_brassknuckles[id])
return FMRES_IGNORED
///////////////////////////
if(pev(id,pev_button) & IN_ATTACK && g_is_in_kungfu[id])
{
client_print(id, print_chat, "You attack like viper! Rrrrr")
}
return FMRES_HANDLED
}