#include <amxmodx>
new KillFeed[33], plnum;
public plugin_init()
{
register_plugin("KillFeed","1.4.0","Dev-cs.ru")
register_message(get_user_msgid("DeathMsg"), "Message_DeathMsg")
register_clcmd("say /kf","kill_feed");
register_clcmd("say_team /kf","kill_feed");
}
public client_putinserver(id)
{
KillFeed[id]=0;
}
public client_disconnected(id)
{
KillFeed[id]=0;
}
public kill_feed(id)
{
switch(KillFeed[id])
{
case 0:
{
KillFeed[id]=1
client_print_color(id, print_team_red,"[^3KillFeed^1] ^4ON")
}
case 1:
{
KillFeed[id]=2
client_print_color(id, print_team_red,"[^3KillFeed^1] ^4OFF ALL")
}
case 2:
{
KillFeed[id]=0
client_print_color(id, print_team_red,"[^3KillFeed^1] ^4OFF")
}
}
}
public Message_DeathMsg(msgid, dest, receiver)
{
enum {arg_killer = 1, arg_victim, arg_headshot, arg_weapon_name };
new killer = get_msg_arg_int(arg_killer);
new victim = get_msg_arg_int(arg_victim);
new headshot = get_msg_arg_int(arg_headshot);
new weapon_name[64];
get_msg_arg_string(arg_weapon_name, weapon_name, charsmax(weapon_name));
if(killer && KillFeed[killer] == 1)
send_deathmsg(msgid, MSG_ONE, killer, killer, victim, headshot, weapon_name)
if(victim != killer && KillFeed[victim] == 1)
send_deathmsg(msgid, MSG_ONE, victim, killer, victim, headshot, weapon_name)
plnum = get_playersnum(0)
for(new id=1; id <= plnum; id++)
{
if(is_user_connected(id))
{
if(KillFeed[id]==0)
send_deathmsg(msgid, MSG_ONE, id, killer, victim, headshot, weapon_name)
}
}
return PLUGIN_HANDLED;
}
stock send_deathmsg(msgid, dest, receiver, killer, victim, headshot, weapon_name[])
{
message_begin(dest, msgid, _, receiver);
write_byte(killer);
write_byte(victim);
write_byte(headshot);
write_string(weapon_name);
message_end();
}