Hi, I am using a plugin and my server shuts down when I get near a model that gets spawned by that plugin with this error:
Code:
FATAL ERROR (shutting down): Hit a dm_item with no model (models/my_test_model.mdl)
The model is not faulty, since I tried using 3 different models, and the same error is thrown.
EDIT: I have backtraced the issue and apparently it occurs when round_start() function is run.
FULL CODE:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#include <cstrike>
#include <engine>
#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""
new const item_class_name[] = "dm_item"
new g_models[] = "models/test.mdl"
public plugin_precache()
{
precache_model(g_models)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_Touch, "fwd_Touch")
register_event("HLTV", "round_start", "a", "1=0", "2=0")
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
}
public fwd_Touch(toucher, touched)
{
if (!is_user_alive(toucher) || !pev_valid(touched))
return FMRES_IGNORED
new classname[32]
pev(touched, pev_classname, classname, 31)
if (!equal(classname, item_class_name))
return FMRES_IGNORED
give_item(toucher)
set_pev(touched, pev(touched, pev_effects ) | EF_NODRAW)
set_pev(touched, pev_solid, SOLID_NOT)
return FMRES_IGNORED
}
public fw_PlayerKilled(victim, attacker, shouldgib)
{
if (!is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim || !attacker)
return HAM_IGNORED
new origin[3]
get_user_origin(victim, origin, 0)
addItem(origin)
return HAM_IGNORED
}
public addItem(origin[3])
{
new ent = fm_create_entity("info_target")
new Float:mins[3] = {-10.0, -10.0, 0.0}, Float:maxs[3] = {10.0, 10.0, 25.0}
set_pev(ent, pev_classname, item_class_name)
engfunc(EngFunc_SetModel,ent, g_models)
engfunc(EngFunc_SetSize, ent, mins, maxs);
set_pev(ent,pev_solid,SOLID_BSP)
set_pev(ent,pev_movetype,MOVETYPE_PUSHSTEP)
new Float:fOrigin[3]
IVecFVec(origin, fOrigin)
set_pev(ent, pev_origin, fOrigin)
set_pev(ent,pev_renderfx,kRenderFxGlowShell)
switch(random_num(1,2))
{
case 1: set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0})
case 2: set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0})
}
}
public give_item(id)
{
switch (random_num(0,1)){
case 0:{
new HP;
HP = 50;
fm_set_user_health(id, get_user_health(id) + HP);
}
case 1:{
fm_give_item(id,"weapon_hegrenade")
}
}
}
public round_start()
{
new ent = FM_NULLENT
static string_class[] = "classname"
while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name)))
set_pev(ent, pev_flags, pev(ent, pev_flags) | FL_KILLME)
}
__________________
We all live under the same sky but we have different horizons.