add isbot

This commit is contained in:
ineed bots 2022-10-03 21:57:10 -06:00
parent 9a3b953478
commit 9b1f27c258
4 changed files with 19 additions and 2 deletions

View File

@ -157,6 +157,10 @@ namespace Components
Utils::Hook(0x501E0D, G_SelectWeaponIndex_Stub, HOOK_CALL).install()->quick();
Utils::Hook(0x52B166, PlayerCmd_setSpawnWeapon_Stub, HOOK_JUMP).install()->quick();
Script::AddMethod("isbot", [](Game::scr_entref_t ent)
{
Game::Scr_AddInt(Game::svs->clients[ent].bot);
});
Script::AddMethod("botaction", [](Game::scr_entref_t ent)
{

View File

@ -203,6 +203,18 @@ namespace Game
return answer;
}
void Scr_AddInt(int num)
{
int func_loc = 0x483580;
__asm
{
push num;
call func_loc;
add esp, 4;
}
}
void G_SelectWeaponIndex(int wpIdx, int clNum)
{
int func_loc = 0x5282E0;

View File

@ -86,6 +86,7 @@ namespace Game
extern const char* Scr_GetString(unsigned int);
extern int Scr_GetInt(unsigned int);
extern void Scr_AddInt(int);
extern void G_SelectWeaponIndex(int, int);
extern void SV_ClientThink(Game::usercmd_s*, Game::client_t*);
extern void SV_DropClient(Game::client_t*, const char*);

View File

@ -812,9 +812,9 @@ namespace Game
typedef int fileHandle_t;
typedef void (__stdcall *xfunction_t)();
typedef void (__cdecl *xfunction_t)();
typedef void (__stdcall *xmethod_t)(scr_entref_t);
typedef void (__cdecl *xmethod_t)(scr_entref_t);
typedef void (*xcommand_t)(void);