Merge remote-tracking branch 'origin/testing' into testing

This commit is contained in:
TotallyNotElite 2018-12-29 16:07:53 +01:00
commit 620e73d0e5
3 changed files with 15 additions and 5 deletions

View File

@ -1282,7 +1282,7 @@ static void DrawText()
if (float(fov) > 0.0f && float(fov) < 180)
{
// Dont show ring while player is dead
if (LOCAL_E->m_bAlivePlayer())
if (CE_GOOD(LOCAL_E) && LOCAL_E->m_bAlivePlayer())
{
rgba_t color = GUIColor();
color.a = float(fovcircle_opacity);

View File

@ -208,7 +208,7 @@ static bool stayNearPlayers(const bot_class_config &config, CachedEntity *&resul
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE)
if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE || (hacks::shared::aimbot::ignore_cloak && IsPlayerInvisible(ent)))
continue;
players.push_back(ent);
}

View File

@ -5,6 +5,7 @@
#include <settings/String.hpp>
#include "HookedMethods.hpp"
#include "PlayerTools.hpp"
static settings::String ipc_name{ "name.ipc", "" };
static settings::String force_name{ "name.custom", "" };
@ -42,7 +43,10 @@ bool StolenName()
if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info))
{
// Invisible character won't fit into name with max. length
if (std::strlen(info.name) >= 32)
if (std::strlen(info.name) >= 31)
continue;
// Ignore Friendly
if (player_tools::shouldTargetSteamId(info.friendsID) != player_tools::IgnoreReason::DO_NOT_IGNORE)
continue;
// If our name is the same as current, then change it
if (stolen_name == info.name && *namesteal == 1)
@ -143,7 +147,7 @@ static InitRoutine init([]() {
if (new_val != 0)
{
const char *xd = GetNamestealName(g_ISteamUser->GetSteamID());
if (CE_BAD(LOCAL_E) || !xd)
if (CE_BAD(LOCAL_E) || !xd || !strcmp(LOCAL_E->player_info.name, xd))
return;
NET_SetConVar setname("name", xd);
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
@ -161,11 +165,17 @@ static void cm()
{
if (!namesteal)
return;
if (!set_name.test_and_set(500000))
if (!set_name.test_and_set(300000))
return;
const char *name = GetNamestealName(g_ISteamUser->GetSteamID());
if (CE_BAD(LOCAL_E) || !name)
return;
// Didn't change name - update timer a bit
if (!strcmp(LOCAL_E->player_info.name, name))
{
set_name.last += std::chrono::seconds(170);
return;
}
NET_SetConVar setname("name", name);
INetChannel *ch = (INetChannel *) g_IEngine->GetNetChannelInfo();
if (ch)