I'm having a problem with Ham_Killed when the weapon used is a knife
Here's what I do:
PHP Code:
public plugin_init()
{
RegisterHam(Ham_Killed, "func_wall", "monster_killed")
}
PHP Code:
public monster_killed(this, idattacker, shouldgib)
{
if(!get_pcvar_num(rehl_switch) || g_zombie[idattacker])
return HAM_IGNORED
//make sure player is connected
if (is_user_connected(idattacker))
{
if(!pev_valid(this))
return HAM_IGNORED
new monmodel[31]
new monster[21], points
entity_get_string(this, EV_SZ_model, monmodel, 30)
if(equal(monmodel, "models/headcrab.mdl")) {
monster = "Head Crab"
points = get_pcvar_num(hea_points)
}
else if(equal(monmodel, "models/zombie.mdl")) {
monster = "Zombie"
points = get_pcvar_num(zom_points)
}
else return HAM_IGNORED
rehl_points[idattacker] += points
new frags = get_user_frags(idattacker) + 1
set_user_frags(idattacker, frags)
new msg[250]
format(msg, 249, "^x04[RE:HL Mod] ^x01You got '^x03%d^x01' points for killing a '^x04%s^x01'!", points, monster)
colored_msg(idattacker, msg, MSG_ONE, saytext)
cs_set_user_deaths(idattacker, cs_get_user_deaths(idattacker))
remove_entity(this)
}
return HAM_HANDLED
}
When a monster is killed with a knife the server crashs
Can anyone help plz
__________________