The bot get created and put in the server without issues but when it get spawned (round start) it keeps floating in the air with idle animation (swimming like animation) and when i add pfnRunPlayerMove the bot starts teleporting to specific points (same points no matter what the spawn point or restarting the server) and it keeps cycling through the points.
The bot get added when the console command "
ab
" is called and it's handled in pfnClientCommand
hook:
edict_t* botEntity; // holds bot entity
void ClienCommand(edict_t* pEntity)
{
const char* cmd = CMD_ARGV(0);
if (FStrEq(cmd, "ab"))
{
botEntity = CREATE_FAKE_CLIENT("bot1");
CALL_GAME_ENTITY(PLID, "player", VARS(botEntity));
int botIndex = ENTINDEX(botEntity); // edict index
char* botInfobuffer = GET_INFOKEYBUFFER(botEntity);
// set bot info
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "model", "gordon");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "rate", "3500.000000");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "cl_updaterate", "20");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "cl_lw", "1");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "cl_lc", "1");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "tracker", "0");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "cl_dlmax", "128");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "lefthand", "1");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "friends", "0");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "dm", "0");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "ah", "1");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "_vgui_menus", "0");
SET_CLIENT_KEYVALUE(botIndex, botInfobuffer, "*bot", "1");
// fake connect
char reject[128];
MDLL_ClientConnect(botEntity, "bot1", "127.0.0.1", reject);
botEntity->v.flags = FL_FAKECLIENT | FL_CLIENT;
// put the bot in server
MDLL_ClientPutInServer(botEntity);
botEntity->v.idealpitch = botEntity->v.v_angle.x;
botEntity->v.ideal_yaw = botEntity->v.v_angle.y;
botEntity->v.pitch_speed = 270;
botEntity->v.yaw_speed = 250;
// join a team (auto asign)
FakeClientCommand(botEntity, "jointeam", "5", 0);
// choose a model (auto)
FakeClientCommand(botEntity, "menuselect", "5", 0);
}
}
And in StartFrame
hook hir where i handle bot logic where pfnRunPlayerMove
:
void StartFrame(void)
{
if (botEntity)
{
if (botEntity->v.deadflag == DEAD_NO) // not dead
{
botEntity->v.button = IN_DUCK; // test duck button, it works... but it keeps teleporting !!
// write bot origins to server console
char txt[255];
sprintf(txt, "X: %f, Y: %f, Z: %f \n\0", botEntity->v.origin.x, botEntity->v.origin.y, botEntity->v.origin.z);
SERVER_PRINT(txt);
// pfnRunPlayerMove
PLAYER_RUN_MOVE(botEntity, botEntity->v.angles, 0, 0, 0, botEntity->v.button, 0, gpGlobals->frametime);
}
}
}
And theses are the points that it keeps teleporting to (map: de_dust):How does
pfnRunPlayerMove
really works ?? i looked in the HLSDK but there is only the declaration in eiface.h
,I tried it with OG metamod, metamod-p and metamod-r with ReGameDLL_CS but the same results,
I couldn't find where to post this issue so TWHL is my last hope xD
I'm totally new to GoldSrc so i'm open to learn anything you throw at me, and thx !!!!