Quote:
Originally Posted by stefanhendriks
how did you fix this?
edit:
i see, you have made an own dll. It probably uses the 'search for map_init entity' thingy to make rb aware the round has started. Neat!
|
...very simple.
Code:
bool hltvreceived = false;
int message_HLTV;
void pfnMessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed)
{
if (msg_type == message_HLTV && msg_dest == 9)
hltvreceived = TRUE;
g_engfuncs.pfnMessageBegin(msg_dest, msg_type, pOrigin, ed);
}
int pfnRegUserMsg(const char *pszName, int iSize)
{
int iType = g_engfuncs.pfnRegUserMsg(pszName,iSize);
if (FStrEq(pszName, "HLTV"))
message_HLTV = iType;
return iType;
}
void pfnWriteByte(int iValue)
{
if (hltvreceived)
{
if (iValue == 0)
g_bot_engfuncs->pfnFindEntityByString(NULL, "classname", "info_map_parameters");
}
hltvreceived = false;
g_engfuncs.pfnWriteByte (iValue);
}
About the g_bot_engfuncs thing:
Code:
void DLLEXPORT GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals )
{
memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t));
gpGlobals = pGlobals;
h_Library = LoadLibrary("realbot/dll/realbot.dll");
assert(h_Library);
other_GetEntityAPI = (GETENTITYAPI)GetProcAddress(h_Library, "GetEntityAPI");
other_GetNewDLLFunctions = (GETNEWDLLFUNCTIONS)GetProcAddress(h_Library, "GetNewDLLFunctions");
other_GiveFnptrsToDll = (GIVEFNPTRSTODLL)GetProcAddress(h_Library, "GiveFnptrsToDll");
pengfuncsFromEngine->pfnMessageBegin = pfnMessageBegin;
pengfuncsFromEngine->pfnRegUserMsg = pfnRegUserMsg;
pengfuncsFromEngine->pfnWriteByte = pfnWriteByte;
// give the engine functions to the other DLL...
(*other_GiveFnptrsToDll)(pengfuncsFromEngine, pGlobals);
g_bot_engfuncs = pengfuncsFromEngine;
}
Quote:
I will put this fix on my website (well a link to your website) if you don't mind?
|
Of course I don't mind ! Go ahead...