Quote:
Originally Posted by The Storm
Too bad that so many years even Valve with their CSBot didn't suspected that this is the problem
|
The official CS bot doesn't use these variables!
The official bot uses only "*bot" key value - that's all!!!
Quote:
Originally Posted by The Storm
By the mean "deleting these lines" are you saying that we should unset them for the bot like that:
|
At bot creation his client_t structure is nulled:
Code:
Q_memset(fakeclient, 0, sizeof (client_t));
(structure client_t contains values of variables cl and lw) - so, values of these variables are always equal 0
ADDED: bonus
Code:
edict_t *PF_CreateFakeClient_I (const char *netName)
{
client_t *fakeclient (NULL);
int index;
for (index = 0; index < svs.maxclients; ++index)
{
fakeclient = &svs.clients[index];
if (!fakeclient->active && !fakeclient->spawned && !fakeclient->connected)
break;
}
if (index == svs.maxclients)
return NULL; // server is full
edict_t *const fakeclientEdict = EDICT_NUM (index + 1);
if (fakeclient->frames != NULL)
SV_ClearFrames (fakeclient->frames);
// Wipe the client structure
Q_memset (fakeclient, 0, 0x5008u);
// Set up client structure.
fakeclient->UNKNOWN10_resource.pPrev = &fakeclient->UNKNOWN10_resource;
fakeclient->UNKNOWN10_resource.pNext = &fakeclient->UNKNOWN10_resource;
fakeclient->UNKNOWN9_resource.pPrev = &fakeclient->UNKNOWN9_resource;
fakeclient->UNKNOWN9_resource.pNext = &fakeclient->UNKNOWN9_resource;
Q_strncpy (fakeclient->name, netName, 32);
fakeclient->active = true;
fakeclient->spawned = true;
fakeclient->UNKNOWN0 = true;
fakeclient->connected = true;
fakeclient->fakeclient = true;
fakeclient->userid = g_userid++;
fakeclient->name[31] = '\0';
fakeclient->UNKNOWN1 = 0;
fakeclient->edict = fakeclientEdict;
fakeclientEdict->netname = fakeclient->name - pr_strings;
fakeclientEdict->pContainingEntity = fakeclientEdict;
fakeclientEdict->flags = FL_CLIENT | FL_FAKECLIENT;
Info_SetValueForKey (fakeclient->userinfo, "name", netName, 256);
Info_SetValueForKey (fakeclient->userinfo, "model", "gordon", 256);
Info_SetValueForKey (fakeclient->userinfo, "topcolor", "1", 256);
Info_SetValueForKey (fakeclient->userinfo, "bottomcolor", "1", 256);
fakeclient->sendinfo = true;
SV_ExtractFromUserinfo (fakeclient); // parse some info from the info strings
fakeclient->steamID = ISteamGameServer_CreateUnauthenticatedUserConnection ();
fakeclient->UNKNOWN7_connectionInformation.UNKNOWN0_typeOrStatus = 1;
ISteamGameServer_BUpdateUserData (fakeclient->steamID, netName, 0);
return fakeclientEdict;
}