unexpected result
Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <reapi>
new g_iFrame;
public plugin_init()
{
RegisterHookChain(RH_ED_Free, "fw_OnFreeEdictPre");
register_forward(FM_StartFrame, "fw_OnStartFrame")
RegisterHam(Ham_Think, "info_target", "fw_NextThink");
RegisterHam(Ham_Think, "info_target", "fw_NextThink", true);
}
public plugin_cfg()
{
set_task(5.0, "test_func");
}
public fw_OnStartFrame()
{
g_iFrame++;
}
public test_func()
{
new iEnt = rg_create_entity("info_target");
if (iEnt > 0) {
set_entvar(iEnt, var_classname, "test_kill");
new szClassname[32]; get_entvar(iEnt, var_classname, szClassname, charsmax(szClassname));
server_print("~~~ OnSpawn [%s][%f][%d]", szClassname, get_gametime(), g_iFrame);
dllfunc(DLLFunc_Think, iEnt);
set_entvar(iEnt, var_nextthink, get_gametime());
set_entvar(iEnt, var_flags, FL_KILLME);
dllfunc(DLLFunc_Think, iEnt);
dllfunc(DLLFunc_Think, iEnt);
}
}
public fw_NextThink(iEnt)
{
new szClassname[32]; get_entvar(iEnt, var_classname, szClassname, charsmax(szClassname));
server_print("~~~ OnEntThink [%s][%f][%d]", szClassname, get_gametime(), g_iFrame);
}
public fw_OnFreeEdictPre(iEnt)
{
new szClassname[32]; get_entvar(iEnt, var_classname, szClassname, charsmax(szClassname));
server_print("~~~ OnEntRemove [%s][%f][%d]", szClassname, get_gametime(), g_iFrame);
}
Code:
~~~ OnSpawn [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntThink [test_kill][6.074496][4047]
~~~ OnEntRemove [test_kill][6.074496][4047]
seems like not on think? but on end of the server's frame tick?
or OnStartFrame call after check all ents on flkillme flag?
__________________