Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <gunxpmod>
#include <xs>
new PLUGIN_NAME[] = "Unlock : Baseball Bat"
new PLUGIN_AUTHOR[] = "DoviuX"
new PLUGIN_VERSION[] = "1.0"
new g_KnockBack
new g_baseballbat
new const BAT_MDL[] = "models/UmbrellaSwarm/v_BaseBallBat.mdl";
new bool:g_BASEBALLBAT[33]
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_gxm_item("BaseBall Bat", "Big KnockBack", 80)
g_KnockBack = register_cvar("gxm_bat_knockback", "100")
register_event("CurWeapon", "Event_CurWeaponbat", "be", "1=1")
RegisterHam(Ham_TakeDamage, "player", "Player_TakeDamage", 1)
}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, BAT_MDL);
}
public gxm_item_enabled(id) {
g_BASEBALLBAT[id] = true
}
public client_connect(id)
{
g_BASEBALLBAT[id] = false
}
public Event_CurWeaponbat(id)
{
if (!g_BASEBALLBAT[id])
return PLUGIN_CONTINUE;
new Gun = read_data(2)
if( Gun == CSW_KNIFE)
{
set_pev(id, pev_viewmodel2, BAT_MDL)
}
return PLUGIN_CONTINUE;
}
public Player_TakeDamage(id, inflictor, attacker, Float:flDamage, damagebits)
{
if( !attacker
|| id == attacker
|| inflictor != attacker// )
|| get_user_weapon(attacker) != g_baseballbat )
{
return
}
new Float:fDir[3], Float:fOrigin[3], Float:fVelocity[3]
pev(id, pev_origin, fDir)
pev(attacker, pev_origin, fOrigin)
xs_vec_sub(fDir, fOrigin, fDir)
xs_vec_normalize(fDir, fDir)
flDamage *= get_pcvar_num(g_KnockBack)
if( flDamage > 1500.0 )
flDamage = 1500.0
pev(id, pev_velocity, fVelocity)
xs_vec_mul_scalar(fDir, flDamage, fDir)
xs_vec_add(fVelocity, fDir, fVelocity)
set_pev(id, pev_velocity, fVelocity)
}
?