Please open Telegram to view this post
VIEW IN TELEGRAM
👍10😱2❤1
Please open Telegram to view this post
VIEW IN TELEGRAM
👍6❤1
__int64 (*osub_46EFD0)(_DWORD *a1, unsigned __int8 *a2, unsigned int a3, char a4) = nullptr;
__int64 __fastcall hsub_46EFD0(_DWORD *a1, unsigned __int8 *a2, unsigned int a3, char a4)
{
if (!a1 || !a2)
return 0xFFFFFFFF;
return osub_46EFD0(a1, a2, a3, a4);
}
unsigned __int64 __fastcall (*osub_397138)(int a1, __int64 a2, __int64 *a3, int a4, long double a5);
unsigned __int64 __fastcall hsub_397138(int a1, __int64 a2, __int64 *a3, int a4, long double a5)
{
if (!a2)
return 0;
if (a1 == 1 || a1 == 12 || a1 == 13 || a1 == 14)
return 0;
return osub_397138(a1, a2, a3, a4, a5);
}
shadowhook_hook_func_addr((void*)(anogs + 0x46EFD0), (void *)hsub_46EFD0, (void **) &osub_46EFD0);
shadowhook_hook_func_addr((void*)(anogs + 0x397138), (void *)hsub_397138, (void **) &osub_397138);
👍7❤1
被喵预警完整代码
if (被瞄预警)
{
// 1. 缓存结构(保留)
struct Target { char name[32]; char weapon[32]; float dist; };
static std::array<Target, 8> cache;
static size_t count = 0;
// 2. 定时器(保留,控制检测频率)
static float timer = 0.0f;
timer += GetDeltaTime();
if (timer >= 0.1f)
{
timer = 0.0f;
count = 0;
auto Actors = getActors();
for (auto Actor : Actors)
{
if (count >= 8) break;
if (isObjectInvalid(Actor)) continue;
if (!Actor->IsA(ASTExtraPlayerCharacter::StaticClass())) continue;
auto Enemy = (ASTExtraPlayerCharacter*)Actor;
// 跳过自己、死亡、队友(保留基础过滤,可根据需求删)
if (Enemy == g_LocalPlayer Enemy->bDead Enemy->Health <= 0.0f || Enemy->TeamID == g_LocalController->TeamID)
continue;
// 3. 核心:计算敌人视角方向 + 敌人→你的方向(无视掩体)
FVector EPos = Enemy->RootComponent->RelativeLocation;
SDK::FRotator ControlRot = Enemy->GetControlRotation();
const float kPi = 3.14159265358979323846f;
float YawRad = ControlRot.Yaw * kPi / 180.0f;
float PitchRad = ControlRot.Pitch * kPi / 180.0f;
FVector EDir;
EDir.X = cos(YawRad) * cos(PitchRad);
EDir.Y = sin(YawRad) * cos(PitchRad);
EDir.Z = sin(PitchRad);
FVector MPos = g_LocalPlayer->RootComponent->RelativeLocation;
FVector ToMe = { MPos.X - EPos.X, MPos.Y - EPos.Y, MPos.Z - EPos.Z };
// 4. 归一化方向向量(去掉距离过近检测,即使贴脸也计算)
float lenSq = ToMe.X * ToMe.X + ToMe.Y * ToMe.Y + ToMe.Z * ToMe.Z;
if (lenSq < 1e-6f) continue; // 极端情况(几乎重合),避免除以0
float invLen = 1.0f / sqrtf(lenSq);
ToMe.X *= invLen;
ToMe.Y *= invLen;
ToMe.Z *= invLen;
// 5. 仅用点积判断视角是否对准(无视掩体)
float dot = EDir.X * ToMe.X + EDir.Y * ToMe.Y + EDir.Z * ToMe.Z;
// 阈值0.99619对应~5°,可自己调(值越近1,角度越小)
if (dot < 0.99619f) continue;
// 6. 填充缓存(保留)
strncpy(cache[count].name, Enemy->PlayerName.ToString(), 31);
const char* w = "拳头";
if (auto WMC = Enemy->WeaponManagerComponent)
if (auto CW = (ASTExtraShootWeapon*)WMC->CurrentWeaponReplicated)
w = 枪械信息((int)CW->GetWeaponID());
strncpy(cache[count].weapon, w, 31);
cache[count].dist = sqrtf(lenSq) * 0.01f; // 距离计算保留
++count;
}
}
// 7. 绘制缓存(保留,按原逻辑画)
const float lineH = 20.0f;
float y = glHeight * 0.25f;
for (size_t i = 0; i < count; ++i)
{
char line[128];
snprintf(line, sizeof(line), "%s 使用 %s 瞄准您 %.0fM",
cache[i].name, cache[i].weapon, cache[i].dist);
ImVec2 sz = ImGui::CalcTextSize(line, nullptr, 26.0f);
ImVec2 pos = ImVec2(glWidth * 0.5f - sz.x * 0.5f, y + i * lineH);
float x = pos.x;
auto Draw = [&](const char* txt, ImU32 col) {
draw->AddText(nullptr, 23.0f, ImVec2(x, pos.y), col, txt);
x += ImGui::CalcTextSize(txt).x;
};
Draw(cache[i].name, IM_COL32(0,180,255,255));
Draw(" 使用 ", IM_COL32(255,255,255,255));
Draw(cache[i].weapon, IM_COL32(255,0,0,255));
Draw(" 瞄准您 ", IM_COL32(255,255,255,255));
char d[16]; snprintf(d, sizeof(d), "%.0f米", cache[i].dist);
Draw(d, IM_COL32(255,255,0,255));
}
}
被喵前置加Drawesp上面
float GetDeltaTime() {
static float lastTime = 0.0f;
float currentTime = (float)clock() / CLOCKS_PER_SEC;
float delta = currentTime - lastTime;
lastTime = currentTime;
return delta;
}
被喵修复代码
if (Enemy == g_LocalPlayer Enemy->bDead Enemy->Health <= 0.0f || Enemy->TeamID == g_LocalController->TeamID)
真正的被瞄准预警 无缺少
👍7