Fix more issues
This commit is contained in:
parent
14e9fd857e
commit
dff28ddf11
@ -118,7 +118,7 @@ void CreateMove()
|
|||||||
current_user_cmd->buttons |= IN_ATTACK2;
|
current_user_cmd->buttons |= IN_ATTACK2;
|
||||||
|
|
||||||
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun))
|
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;
|
current_user_cmd->buttons |= IN_ATTACK2;
|
||||||
|
|
||||||
// We do this as we need to pass whether the aimkey allows aiming to both
|
// We do this as we need to pass whether the aimkey allows aiming to both
|
||||||
|
@ -28,7 +28,7 @@ bool IsProjectile(CachedEntity *ent)
|
|||||||
int NearbyEntities()
|
int NearbyEntities()
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return ret;
|
return ret;
|
||||||
for (int i = 0; i < HIGHEST_ENTITY; i++)
|
for (int i = 0; i < HIGHEST_ENTITY; i++)
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ void CreateMove()
|
|||||||
{
|
{
|
||||||
if (!enable)
|
if (!enable)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (g_pLocalPlayer->clazz != tf_spy)
|
if (g_pLocalPlayer->clazz != tf_spy)
|
||||||
return;
|
return;
|
||||||
|
@ -232,7 +232,7 @@ bool IsProjectile(CachedEntity *ent)
|
|||||||
int NearbyEntities()
|
int NearbyEntities()
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return ret;
|
return ret;
|
||||||
for (int i = 0; i < HIGHEST_ENTITY; i++)
|
for (int i = 0; i < HIGHEST_ENTITY; i++)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ void Run()
|
|||||||
}
|
}
|
||||||
isBacktrackEnabled = true;
|
isBacktrackEnabled = true;
|
||||||
|
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (g_Settings.bInvalid)
|
if (g_Settings.bInvalid)
|
||||||
return;
|
return;
|
||||||
|
@ -301,7 +301,7 @@ static HookedFunction cm(HF_CreateMove, "catbot", 5, []() {
|
|||||||
if (g_Settings.bInvalid)
|
if (g_Settings.bInvalid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (*auto_crouch)
|
if (*auto_crouch)
|
||||||
|
@ -252,7 +252,7 @@ static HookedFunction
|
|||||||
// Check usersettings if enabled
|
// Check usersettings if enabled
|
||||||
if (!*enable)
|
if (!*enable)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
// Something
|
// Something
|
||||||
std::lock_guard<std::mutex> esp_lock(threadsafe_mutex);
|
std::lock_guard<std::mutex> esp_lock(threadsafe_mutex);
|
||||||
|
@ -208,7 +208,7 @@ static HookedFunction
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
// We need a local player to control
|
// 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;
|
follow_target = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -160,7 +160,7 @@ static HookedFunction
|
|||||||
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
|
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
|
||||||
if (!*sandwichaim_enabled)
|
if (!*sandwichaim_enabled)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (sandwichaim_aimkey)
|
if (sandwichaim_aimkey)
|
||||||
{
|
{
|
||||||
@ -208,7 +208,7 @@ static HookedFunction
|
|||||||
return;
|
return;
|
||||||
if (charge_key && !charge_key.isKeyDown())
|
if (charge_key && !charge_key.isKeyDown())
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
||||||
return;
|
return;
|
||||||
@ -235,7 +235,7 @@ static HookedFunction
|
|||||||
[]() {
|
[]() {
|
||||||
if (!*charge_control || charge_aimbotted)
|
if (!*charge_control || charge_aimbotted)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
||||||
return;
|
return;
|
||||||
|
@ -543,11 +543,19 @@ CatCommand debug_tele("navbot_debug", "debug", []() {
|
|||||||
g_GlobalVars->curtime * g_GlobalVars->interval_per_tick);
|
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
|
static HookedFunction
|
||||||
CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 16, []() {
|
CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 16, []() {
|
||||||
if (!enable || !nav::prepare())
|
if (!enable || !nav::prepare())
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer())
|
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (primary_only && enable)
|
if (primary_only && enable)
|
||||||
UpdateSlot();
|
UpdateSlot();
|
||||||
|
@ -279,7 +279,7 @@ void createMove()
|
|||||||
static float last_voice_spam = 0.0f;
|
static float last_voice_spam = 0.0f;
|
||||||
if (g_GlobalVars->curtime - 4.0F > last_voice_spam)
|
if (g_GlobalVars->curtime - 4.0F > last_voice_spam)
|
||||||
{
|
{
|
||||||
switch ((int) voicecommand_spam)
|
switch (*voicecommand_spam)
|
||||||
{
|
{
|
||||||
case 1: // RANDOM
|
case 1: // RANDOM
|
||||||
g_IEngine->ServerCmd(
|
g_IEngine->ServerCmd(
|
||||||
@ -312,10 +312,10 @@ void createMove()
|
|||||||
static int safety_ticks = 0;
|
static int safety_ticks = 0;
|
||||||
static int last_source = 0;
|
static int last_source = 0;
|
||||||
static float last_message = 0;
|
static float last_message = 0;
|
||||||
if ((int) spam_source != last_source)
|
if (*spam_source != last_source)
|
||||||
{
|
{
|
||||||
safety_ticks = 300;
|
safety_ticks = 300;
|
||||||
last_source = (int) spam_source;
|
last_source = *spam_source;
|
||||||
}
|
}
|
||||||
if (safety_ticks > 0)
|
if (safety_ticks > 0)
|
||||||
{
|
{
|
||||||
@ -328,7 +328,7 @@ void createMove()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string> *source = nullptr;
|
const std::vector<std::string> *source = nullptr;
|
||||||
switch ((int) spam_source)
|
switch (*spam_source)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
source = &file.lines;
|
source = &file.lines;
|
||||||
@ -364,10 +364,11 @@ void createMove()
|
|||||||
{
|
{
|
||||||
if (current_index >= source->size())
|
if (current_index >= source->size())
|
||||||
current_index = 0;
|
current_index = 0;
|
||||||
if (random_order)
|
if (random_order && source->size())
|
||||||
{
|
{
|
||||||
current_index = rand() % 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();
|
current_index = rand() % source->size();
|
||||||
}
|
}
|
||||||
|
@ -1218,7 +1218,7 @@ Timer map_check{};
|
|||||||
int erasedelay = 0;
|
int erasedelay = 0;
|
||||||
static HookedFunction
|
static HookedFunction
|
||||||
Move(HookedFunctions_types::HF_CreateMove, "Walkbot", 16, []() {
|
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;
|
return;
|
||||||
if (state::state == WB_DISABLED)
|
if (state::state == WB_DISABLED)
|
||||||
return;
|
return;
|
||||||
|
@ -894,7 +894,7 @@ weaponmode GetWeaponMode()
|
|||||||
int weapon_handle, slot;
|
int weapon_handle, slot;
|
||||||
CachedEntity *weapon;
|
CachedEntity *weapon;
|
||||||
|
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) | CE_BAD(LOCAL_W))
|
||||||
return weapon_invalid;
|
return weapon_invalid;
|
||||||
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
|
weapon_handle = CE_INT(LOCAL_E, netvar.hActiveWeapon);
|
||||||
if (IDX_BAD((weapon_handle & 0xFFF)))
|
if (IDX_BAD((weapon_handle & 0xFFF)))
|
||||||
|
@ -583,7 +583,7 @@ static HookedFunction
|
|||||||
CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
|
CreateMove(HookedFunctions_types::HF_CreateMove, "NavParser", 17, []() {
|
||||||
if (!enabled || status != on)
|
if (!enabled || status != on)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (!LOCAL_E->m_bAlivePlayer())
|
if (!LOCAL_E->m_bAlivePlayer())
|
||||||
{
|
{
|
||||||
@ -636,7 +636,7 @@ static HookedFunction drawcrumbs(HF_Draw, "navparser", 10, []() {
|
|||||||
return;
|
return;
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return;
|
return;
|
||||||
if (CE_BAD(LOCAL_E))
|
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W))
|
||||||
return;
|
return;
|
||||||
if (!LOCAL_E->m_bAlivePlayer())
|
if (!LOCAL_E->m_bAlivePlayer())
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user