Fix more issues

This commit is contained in:
LightCat 2018-11-09 16:34:12 +01:00
parent 14e9fd857e
commit dff28ddf11
13 changed files with 31 additions and 22 deletions

View File

@ -118,7 +118,7 @@ void CreateMove()
current_user_cmd->buttons |= IN_ATTACK2;
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun))
if (auto_spin_up && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0 && !zoomTime.check(1000))
if (auto_spin_up && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo + 4) != 0 && !zoomTime.check(1000))
current_user_cmd->buttons |= IN_ATTACK2;
// We do this as we need to pass whether the aimkey allows aiming to both

View File

@ -28,7 +28,7 @@ bool IsProjectile(CachedEntity *ent)
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
@ -48,7 +48,7 @@ void CreateMove()
{
if (!enable)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (g_pLocalPlayer->clazz != tf_spy)
return;

View File

@ -232,7 +232,7 @@ bool IsProjectile(CachedEntity *ent)
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{

View File

@ -89,7 +89,7 @@ void Run()
}
isBacktrackEnabled = true;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (g_Settings.bInvalid)
return;

View File

@ -301,7 +301,7 @@ static HookedFunction cm(HF_CreateMove, "catbot", 5, []() {
if (g_Settings.bInvalid)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (*auto_crouch)

View File

@ -252,7 +252,7 @@ static HookedFunction
// Check usersettings if enabled
if (!*enable)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
// Something
std::lock_guard<std::mutex> esp_lock(threadsafe_mutex);

View File

@ -208,7 +208,7 @@ static HookedFunction
init();
// We need a local player to control
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
{
follow_target = 0;
return;

View File

@ -160,7 +160,7 @@ static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
if (!*sandwichaim_enabled)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (sandwichaim_aimkey)
{
@ -208,7 +208,7 @@ static HookedFunction
return;
if (charge_key && !charge_key.isKeyDown())
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
@ -235,7 +235,7 @@ static HookedFunction
[]() {
if (!*charge_control || charge_aimbotted)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;

View File

@ -543,11 +543,19 @@ CatCommand debug_tele("navbot_debug", "debug", []() {
g_GlobalVars->curtime * g_GlobalVars->interval_per_tick);
});
static CatCommand debug_ammo("navbot_debug_ammo", "debug", [](){
if (CE_BAD(LOCAL_W) || CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
return;
logging::Info("Clip size: %d %d", CE_INT(LOCAL_W, netvar.m_iClip1), CE_INT(LOCAL_W, netvar.m_iClip2));
for (int i = 0; i < 8; i++)
logging::Info("Ammo Table IDX %d: %d", i, CE_INT(LOCAL_E, netvar.m_iAmmo + 4 * i));
});
static HookedFunction
CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 16, []() {
if (!enable || !nav::prepare())
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (primary_only && enable)
UpdateSlot();

View File

@ -279,7 +279,7 @@ void createMove()
static float last_voice_spam = 0.0f;
if (g_GlobalVars->curtime - 4.0F > last_voice_spam)
{
switch ((int) voicecommand_spam)
switch (*voicecommand_spam)
{
case 1: // RANDOM
g_IEngine->ServerCmd(
@ -312,10 +312,10 @@ void createMove()
static int safety_ticks = 0;
static int last_source = 0;
static float last_message = 0;
if ((int) spam_source != last_source)
if (*spam_source != last_source)
{
safety_ticks = 300;
last_source = (int) spam_source;
last_source = *spam_source;
}
if (safety_ticks > 0)
{
@ -328,7 +328,7 @@ void createMove()
}
const std::vector<std::string> *source = nullptr;
switch ((int) spam_source)
switch (*spam_source)
{
case 1:
source = &file.lines;
@ -364,10 +364,11 @@ void createMove()
{
if (current_index >= source->size())
current_index = 0;
if (random_order)
if (random_order && source->size())
{
current_index = rand() % source->size();
while (current_index == last_index)
int tries = 0;
while (current_index == last_index && tries++ < 1000)
{
current_index = rand() % source->size();
}

View File

@ -1218,7 +1218,7 @@ Timer map_check{};
int erasedelay = 0;
static HookedFunction
Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16, []() {
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (state::state == WB_DISABLED)
return;

View File

@ -894,7 +894,7 @@ weaponmode GetWeaponMode()
int weapon_handle, slot;
CachedEntity *weapon;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) | CE_BAD(LOCAL_W))
return weapon_invalid;
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
if (IDX_BAD((weapon_handle & 0xFFF)))

View File

@ -583,7 +583,7 @@ static HookedFunction
CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
if (!enabled || status != on)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (!LOCAL_E->m_bAlivePlayer())
{
@ -636,7 +636,7 @@ static HookedFunction drawcrumbs(HF_Draw, "navparser", 10, []() {
return;
if (!enabled)
return;
if (CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
return;
if (!LOCAL_E->m_bAlivePlayer())
return;