Quote:
Originally Posted by Sylwester
Probably because variable ent in KILL function is 0. To make it store entity index you need to set task like this:
PHP Code:
set_task(4.0, "KILL", ent)
Also in code you posted set_task is never executed, and you should check if ent is valid in KILL function before trying to remove it.
|
Still crashes
Code:
public fwdSetModel(ent,const model[])
{
if(!pev_valid(ent) || !equal(model,"models/w_hegrenade.mdl"))
return FMRES_IGNORED
switch(g_iCurrentGame)
{
case GAME_DGBALL: engfunc(EngFunc_SetModel, ent, g_szDodgeball_World)
case GAME_ZMBOMBS: engfunc(EngFunc_SetModel, ent, g_szZombiebomb_World)
case GAME_SNOWBALL: engfunc(EngFunc_SetModel, ent, g_szSnowball_World)
case GAME_ANGRYBIRDS: engfunc(EngFunc_SetModel, ent, g_szAngryBirds_World)
default: return FMRES_IGNORED
}
set_task(4.0, "KILL", ent)
return FMRES_SUPERCEDE
}
public KILL(ent, const model[])
{
if(!pev_valid(ent) || !equal(model,"models/w_hegrenade.mdl"))
engfunc(EngFunc_RemoveEntity, ent);
}
__________________