When a grenade is thrown, I want to remove the grenade entity and replace it with my own. I have everything working almost perfectly except if I include the code to remove the original grenade entity the server crashes.
I've been messing with this for 12 hours, anyone have any ideas (Natural Selection mod, btw):
Code:
#include <amxmodx>
#include <fakemeta>
public plugin_init()
{
register_plugin("Crash Test", "1.0", "frustrated");
register_forward(FM_SetModel, "fw_setmodel");
}
public fw_setmodel(ent, model[])
{
if ( !pev_valid(ent) ) {
return FMRES_IGNORED;
}
static classname[32];
pev(ent, pev_classname, classname, 31);
if ( equali(classname, "handgrenade") ) {
// removes entity, then crashes
engfunc(EngFunc_RemoveEntity, ent);
}
return FMRES_IGNORED;
}
It takes 1-10 nades being thrown and then crash. Server restarts. There are no amxx plugin error logs created and I'm running in debug mode.
The only debug info the hl server gives me is totally worthless, as can be expected.
Is there a better place to do this other than FM_SetModel? I saw some code do this for CS in set_model but it was for engine, not fakemeta and it worked... HMMMMMMMMm.