From 9b1f27c2586bb3988ca421a74199bb23c4a5ce67 Mon Sep 17 00:00:00 2001 From: ineed bots Date: Mon, 3 Oct 2022 21:57:10 -0600 Subject: [PATCH] add isbot --- src/Components/Modules/Bots.cpp | 4 ++++ src/Game/Game.cpp | 12 ++++++++++++ src/Game/Game.hpp | 1 + src/Game/Structs.hpp | 4 ++-- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Components/Modules/Bots.cpp b/src/Components/Modules/Bots.cpp index 27940cd..2ef16b7 100644 --- a/src/Components/Modules/Bots.cpp +++ b/src/Components/Modules/Bots.cpp @@ -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) { diff --git a/src/Game/Game.cpp b/src/Game/Game.cpp index 06a6319..0f19a3e 100644 --- a/src/Game/Game.cpp +++ b/src/Game/Game.cpp @@ -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; diff --git a/src/Game/Game.hpp b/src/Game/Game.hpp index f344365..8b7e655 100644 --- a/src/Game/Game.hpp +++ b/src/Game/Game.hpp @@ -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*); diff --git a/src/Game/Structs.hpp b/src/Game/Structs.hpp index 56ff260..487462b 100644 --- a/src/Game/Structs.hpp +++ b/src/Game/Structs.hpp @@ -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);