PHP Code:
#include <amxmodx>
#include <cstrike_const>
#include <fakemeta>
#include <hamsandwich>
const m_pPlayer = 41
const XO_CBASEPLAYERITEM = 4
const MIN_PLAYERS = 4
const Float:DAMAGE_MULTIPLIER = 4.0
new arr_players[MAX_PLAYERS], last_ct, num_ct
new const knife_model[] = "models/v_knife_r.mdl"
public plugin_init()
{
register_event("DeathMsg", "player_killed", "a", "1>0")
RegisterHam(Ham_Item_Deploy, "weapon_knife", "weapon_knife", 1)
RegisterHam(Ham_TakeDamage, "player", "knife_damage")
register_logevent("reset_last_ct", 2, "1=Round_Start")
register_logevent("reset_last_ct", 2, "1=Round_End")
register_event("TextMsg", "reset_last_ct", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
}
public plugin_precache()
precache_model(knife_model)
public client_authorized()
check()
public client_disconnected()
check()
public player_killed()
check()
public reset_last_ct()
last_ct = 0
public check()
{
get_players(arr_players, num_ct, "ae", "CT")
last_ct = (num_ct == 1 ? arr_players[0] : 0)
if (last_ct)
{
if (get_user_weapon(last_ct) == CSW_KNIFE)
client_cmd(last_ct, "lastinv;lastinv")
}
}
public weapon_knife(entity)
{
if (get_playersnum() >= MIN_PLAYERS)
{
new id = get_pdata_cbase(entity, m_pPlayer, XO_CBASEPLAYERITEM)
if (id == last_ct)
set_pev(id, pev_viewmodel2, knife_model)
}
}
public knife_damage(victim, i, id, Float:dmg)
{
if (get_playersnum() >= MIN_PLAYERS)
{
if (is_user_connected(id))
{
if(id == last_ct && get_user_weapon(id) == CSW_KNIFE)
SetHamParamFloat(4, dmg * DAMAGE_MULTIPLIER)
}
}
}
__________________