#include <amxmodx>
#define PLUGIN "WeaponKill"
#define VERSION "1.01"
#define AUTHOR "Slove."
new const KillSoundList[][] =
{
"zvukkill/knife1.mp3",
"zvukkill/granade_kill.mp3",
"zvukkill/suicide.mp3"
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "death_message", "a")
}
public plugin_precache()
{
new i;
for(i = 0; i < sizeof(KillSoundList); i++)
precache_sound(KillSoundList[i])
}
public death_message()
{
new killer = read_data(1)
new victim = read_data(2)
new weapon[32]
read_data(4, weapon, 31)
if(equali(weapon, "knife") & is_user_connected(killer))
{
client_cmd(0, "mp3 play sound/%s", KillSoundList[0])
new kname[32], vname[32]
get_user_name(killer, kname, 31)
get_user_name(victim, vname, 31)
chat_print(0, "^4[Сервер] ^1Игрок ^4%s ^1зарезал ^4%s ^1и стал ^3его врагом.", kname,vname)
}
else
if(equali(weapon, "grenade") & is_user_connected(killer))
{
client_cmd(0, "mp3 play sound/%s", KillSoundList[1])
new kname[32], vname[32]
get_user_name(killer, kname, 31)
get_user_name(victim, vname, 31)
chat_print(0, "^4[Сервер] ^1Игрок ^4%s ^1подорвал ^4%s ^1и стал ^3подрывником.", kname,vname)
}
else
if(victim == killer)
{
client_cmd(0, "mp3 play sound/%s", KillSoundList[2])
new kname[32], vname[32]
get_user_name(killer, kname, 31)
get_user_name(victim, vname, 31)
chat_print(0, "^4[Сервер] ^1Игрок ^4%s ^1совершил ^4самоубийство", kname,vname)
}
return PLUGIN_CONTINUE
}
stock chat_print(const id, const input[], any:...)
{
new nCount = 1, nNum[32]
static nMsgs[191]
vformat(nMsgs, 190, input, 3)
replace_all(nMsgs, 190, "!g", "^4")
replace_all(nMsgs, 190, "!n", "^1")
replace_all(nMsgs, 190, "!t", "^3")
if(id) nNum[0] = id; else get_players(nNum, nCount, "ch")
{
for(new i = 0; i < nCount; i++)
{
if(is_user_connected(nNum[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, nNum[i])
write_byte(nNum[i])
write_string(nMsgs)
message_end()
}
}
}
}