Can't get fakeclient to spawn in CS:S
Ok so I have finally hit a wall and I am forced to ask a question.
I am trying to basically create a puppet that can be moved about using the default PlayerRunCommand() logic. I originally was superceding PlayerRunCommand() on a default CS:S bot but I need to be able to use the PlayerRunCommand() without it executing all of the bot's AI. So I have switched to creating a fakeclient which I am hoping has the same logic in its PlayerRunCommand() as a CSSPlayer.
So far my code looks like this:
This gets the client into the server and onto a team but he stays dead on that team. I'm not sure if his class is selected or not.
Thanks in advance.
EDIT: Those are all manual hooks from the vtable offsets at http://www.sourcemodplugins.org/pages/vtableoffsets/
I am trying to basically create a puppet that can be moved about using the default PlayerRunCommand() logic. I originally was superceding PlayerRunCommand() on a default CS:S bot but I need to be able to use the PlayerRunCommand() without it executing all of the bot's AI. So I have switched to creating a fakeclient which I am hoping has the same logic in its PlayerRunCommand() as a CSSPlayer.
So far my code looks like this:
PHP Code:
// Called when I want to add one of these puppets
edict_t *pEntity = engine->CreateFakeClient( botname );
void BotPlugin::Hook_ClientActive(edict_t *pEntity, bool bLoadGame)
{
META_LOG(g_PLAPI, "SUCCESS: ClientActive() called\n");
CBasePlayer *pPlayer = dynamic_cast< CBasePlayer * >(  ;CBaseEntity::Instance( pEntity ) );
ClearFlags();
AddFlag( FL_CLIENT | FL_FAKECLIENT );
pPlayer->AllowInstantSpawn(); // I'm not sure this is actually doing anything
SH_MCALL(pPlayer, MHook_ChangeTeam)(3);
engine->ClientCommand(pPlayer->edict(), "joinclass 0");
if (SH_MCALL(pPlayer, MHook_IsReadyToSpawn)())
{
// Currently this is what I am doing but I have tried all of the commented out ones below as well.
SH_MCALL(pPlayer, MHook_RemoveAllItems)(true);
SH_MCALL(pPlayer, MHook_EntSelectSpawnPoint)();
RoundRespawn(); //  ;I sigscan for this and call it in this function I'm not sure if my signature is correct
/* void CCSPlayer::RoundRespawn( void );
Signature:
"83 EC 14 53 56 8B F1 8B 0D ? ? ? ? 33 DB"
*/
//SH_MCALL(pPlayer, MHook_InitialSpawn)();
//SH_MCALL(pPlayer, MHook_Spawn)();
//SH_MCALL(pPlayer, MHook_Respawn)();
  ; //SH_MCALL(pPlayer, MHook_ForceRespawn)();
}
RETURN_META(MRES_IGNORED);
}
Thanks in advance.
EDIT: Those are all manual hooks from the vtable offsets at http://www.sourcemodplugins.org/pages/vtableoffsets/
Orignal From: Can't get fakeclient to spawn in CS:S
Post a Comment