When I type /give_helmet, the CS crash and showed windows dialog "Solid_BSP Without Movetype_Push". What's wrong?
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <fakemeta_stocks>
#define PLUGIN "Helmet Protection"
#define VERSION "1.0"
#define AUTHOR "DavidJr"
new bool:g_have_helmet[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /helmet", "give_helmet")
register_concmd("helmet", "give_helmet")
RegisterHam(Ham_TraceAttack, "player", "fw_trace")
}
public plugin_precache()
{
precache_model("models/cspb/headgear.mdl")
}
public fw_trace(victim, id, Float:damage, Float:dir[3], ptr, bits)
{
new victim = read_data(2)
if (get_user_attacker(id) == victim && is_user_connected(id) && is_user_alive(id))
{
if (get_tr2(ptr, TR_iHitgroup) == HIT_HEAD) //be attacked on head, drop the helmet
{
client_cmd(id, "spk cspb/helmet_hit.wav")
client_cmd(victim, "spk cspb/helmet_protection.wav")
client_print(victim, print_chat, "Helmet Protection!")
g_have_helmet[id] = false
drop_helmet(id)
}
}
return HAM_IGNORED
}
public give_helmet(id, imodelnum, targeter) //set helmet on head
{
if (g_have_helmet[id] == false)
{
set_pev(g_have_helmet[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_have_helmet[id], pev_aiment, id)
set_pev(g_have_helmet[id], pev_rendermode, kRenderNormal)
engfunc(EngFunc_SetModel, g_have_helmet[id], "models/cspb/headgear.mdl")
client_print(id, print_chat, "You got a helmet.")
}
return true
}
public drop_helmet(id) //drop helmet on ground
{
if (g_have_helmet[id] == true)
{
set_pev(g_have_helmet[id], pev_movetype, MOVETYPE_NONE)
set_pev(g_have_helmet[id], pev_aiment, id)
set_pev(g_have_helmet[id], pev_rendermode, kRenderNormal)
engfunc(EngFunc_SetModel, g_have_helmet[id], "models/cspb/headgear.mdl")
}
return false
}