You should hook PvAllocEntPrivateData call from gamedll, check the passed entity for bot and register ham on it. But you can't hook it with amxx, so then you should hook GetInfoKeyBuffer, it is first engine function called after PvAllocEntPrivateData on bot creating.
That is my old code for this:
PHP Code:
#include <amxmodx>
#include <fakemeta>
new g_iFakeClientByGameDll;
new g_fwdCreateFakeClient_Post;
new g_fwdGetInfoKeyBuffer;
public plugin_init() {
g_fwdCreateFakeClient_Post = register_forward(FM_CreateFakeClient, "CreateFakeClient_Post", true);
g_fwdGetInfoKeyBuffer = register_forward(FM_GetInfoKeyBuffer, "GetInfoKeyBuffer");
}
public CreateFakeClient_Post() {
new iEntity = get_orig_retval();
if (!pev_valid(iEntity)) {
return;
}
g_iFakeClientByGameDll = iEntity;
}
public GetInfoKeyBuffer(const iEntity) {
if (!g_iFakeClientByGameDll) {
return;
}
g_iFakeClientByGameDll = 0;
unregister_forward(FM_CreateFakeClient, g_fwdCreateFakeClient_Post, true);
unregister_forward(FM_GetInfoKeyBuffer, g_fwdGetInfoKeyBuffer);
new iRet;
new fwd = CreateMultiForward("CSBot_Init", ET_IGNORE, FP_CELL);
ExecuteForward(fwd, iRet, iEntity);
DestroyForward(fwd);
}
__________________