ADDED: Weapon name ESP (unlocalized), cat_fb_mimic_slot, fixed crash on

running connect <IP> console command using IPC (and disconnect too)
This commit is contained in:
nullifiedcat 2017-03-23 19:01:15 +03:00
parent 9b204eceaf
commit f59a41d0c4
6 changed files with 36 additions and 7 deletions

View File

@ -53,15 +53,20 @@
bool hack::shutdown = false;
std::mutex hack::command_stack_mutex;
std::stack<std::string>& hack::command_stack() {
static std::stack<std::string> stack;
return stack;
}
void hack::ExecuteCommand(const std::string command) {
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
hack::command_stack().push(command);
}
void hack::InitHacks() {
}
//std::mutex hack::command_stack_mutex;
ConCommand* hack::c_Cat = 0;
void hack::CC_Cat(const CCommand& args) {

View File

@ -23,8 +23,9 @@ class CCommand;
namespace hack {
//extern std::mutex command_stack_mutex;
extern std::mutex command_stack_mutex;
std::stack<std::string>& command_stack();
void ExecuteCommand(const std::string command);
extern bool shutdown;

View File

@ -12,6 +12,7 @@
namespace hacks { namespace shared { namespace esp {
CatVar show_weapon(CV_SWITCH, "esp_weapon", "1", "Show weapon name", "Show which weapon does the enemy use");
CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player", "Shows local player ESP in thirdperson");
CatVar buildings(CV_SWITCH, "esp_buildings", "1", "Building ESP", "Show buildings");
CatVar enabled(CV_SWITCH, "esp_enabled", "0", "ESP", "Master ESP switch");
@ -308,6 +309,12 @@ void ProcessEntity(CachedEntity* ent) {
AddEntityString(ent, "CRIT BOOSTED");
}
}
CachedEntity* weapon = ENTITY(CE_INT(ent, netvar.hActiveWeapon) & 0xFFF);
if (CE_GOOD(weapon)) {
if (show_weapon) {
AddEntityString(ent, std::string(vfunc<const char*(*)(IClientEntity*)>(weapon->m_pEntity, 398, 0)(weapon->m_pEntity)));
}
}
}
return;
}

View File

@ -34,6 +34,7 @@ CatCommand follow_entity("fb_follow_entity", "Follows entity with specified enti
logging::Info("not yet implemented.");
});
CatVar bot(CV_SWITCH, "fb_bot", "0", "This player is a bot", "Set to 1 in followbots' configs");
CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "1", "Mimic selected weapon", "If enabled, this bot will select same weapon slot as the owner");
// I've spent 2 days on writing this method.
// I couldn't succeed.
@ -107,6 +108,19 @@ void DoWalking() {
}
}
CachedEntity* found_entity = ENTITY(following_idx);
if (mimic_slot) {
CachedEntity* owner_weapon = ENTITY(CE_INT(found_entity, netvar.hActiveWeapon) & 0xFFF);
if (CE_GOOD(owner_weapon) && CE_GOOD(g_pLocalPlayer->weapon())) {
// FIXME proper classes
const int my_slot = vfunc<int(*)(IClientEntity*)>(g_pLocalPlayer->weapon()->m_pEntity, 395, 0)(g_pLocalPlayer->weapon()->m_pEntity);
const int owner_slot = vfunc<int(*)(IClientEntity*)>(owner_weapon->m_pEntity, 395, 0)(owner_weapon->m_pEntity);
if (my_slot != owner_slot) {
g_IEngine->ExecuteClientCmd(format("slot", owner_slot + 1).c_str());
}
}
}
if (!found_entity->IsVisible()) {
if (!lost_time) {
lost_time = g_GlobalVars->curtime;

View File

@ -77,6 +77,7 @@ void Draw() {
if (!debug_info) return;
if (CE_GOOD(g_pLocalPlayer->weapon())) {
AddSideString(format("Slot: ", vfunc<int(*)(IClientEntity*)>(g_pLocalPlayer->weapon()->m_pEntity, 395, 0)(g_pLocalPlayer->weapon()->m_pEntity)));
/*AddSideString(colors::white, "Weapon: %s [%i]", RAW_ENT(g_pLocalPlayer->weapon())->GetClientClass()->GetName(), g_pLocalPlayer->weapon()->m_iClassID);
//AddSideString(colors::white, "flNextPrimaryAttack: %f", CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack));
//AddSideString(colors::white, "nTickBase: %f", (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * gvars->interval_per_tick);

View File

@ -72,12 +72,13 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
draw_flag = false;
{
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ExecuteClientCmd(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
logging::Info("executing %s", hack::command_stack().top().c_str());
g_IEngine->ClientCmd_Unrestricted(hack::command_stack().top().c_str());
hack::command_stack().pop();
}
}
if (disable_visuals) return;