Draw aimbot FOV
#define PI 3.14159265359
#define DEG2RAD(x) ((x) * PI / 180)
constexpr void drawFov() noexcept
{
if (config.misc.drawFOV && interfaces.engine->isInGame()) {
auto local = interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer());
if (!local || !local->isAlive()) return;
int weaponId = getWeaponIndex(local->getActiveWeapon()->getProperty<WeaponId>("m_iItemDefinitionIndex"));
if (!config.aimbot[weaponId].enabled) weaponId = 0;
if (!config.aimbot[weaponId].enabled) return;
auto screenSize = interfaces.surface->getScreenSize();
if (config.aimbot[weaponId].silent) interfaces.surface->setDrawColor(255, 10, 10, 255);
else interfaces.surface->setDrawColor(10, 255, 10, 255);
float radius = std::tan(DEG2RAD(config.aimbot[weaponId].fov) / 2.f) / std::tan(DEG2RAD(local->getProperty<bool>("m_bIsScoped") ? local->getProperty<int>("m_iFov") : (90 + config.visuals.fov)) / 2.f) * screenSize.first;
interfaces.surface->drawOutlinedCircle(screenSize.first / 2, screenSize.second / 2, radius, 100);
}
}
Looks alot cleaner than what i did rn. Btw does it work for double zoom?
This does not work correctly when using a single scope.
Where do I need to put it ? :)
misc.h and call it from paintTraverse hook like this
//some stuff before this
Misc::spectatorList();
Misc::drawFov();
//and after this
and put
bool drawFOV{false};
in Misc config struct and put
ImGui::Checkbox("Draw Aimbot FOV", &config.misc.drawFOV);
in GUI.cpp near of
ImGui::Checkbox("Watermark", &config.misc.watermark);
in config.cpp put
if (miscJson.isMember("Draw FOV")) misc.drawFOV = miscJson["Draw Fov"].asBool();
near of
if (miscJson.isMember("Watermark")) misc.watermark = miscJson["Watermark"].asBool();
and final put
miscJson["Draw FOV"] = misc.drawFOV;
near of
miscJson["Watermark"] = misc.watermark;
It doesnt draw accurately though like the fov is 2x less than what is drawn.
update: hooks.cpp
static void __stdcall overrideView(ViewSetup* setup) noexcept
{
if (interfaces.engine->isInGame()
&& !interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer())->getProperty<bool>("m_bIsScoped"))
setup->fov += config.visuals.fov;
setup->farZ += config.visuals.farZ * 10;
Misc::actualFov = setup->fov;
hooks.clientMode.callOriginal<void, ViewSetup*>(18, setup);
}
misc.h
static float actualFov = 0.0f;
constexpr void drawFov() noexcept
{
if (config.misc.drawFOV && interfaces.engine->isInGame()) {
auto local = interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer());
if (!local || !local->isAlive()) return;
if (!local->getActiveWeapon()) return;
int weaponId = getWeaponIndex(local->getActiveWeapon()->getProperty<WeaponId>("m_iItemDefinitionIndex"));
if (!config.aimbot[weaponId].enabled) weaponId = 0;
if (!config.aimbot[weaponId].enabled) return;
auto screenSize = interfaces.surface->getScreenSize();
if (config.aimbot[weaponId].silent) interfaces.surface->setDrawColor(255, 10, 10, 255);
else interfaces.surface->setDrawColor(10, 255, 10, 255);
float radius = std::tan(DEG2RAD(config.aimbot[weaponId].fov) / 2.f) / std::tan(DEG2RAD(actualFov) / 2.f) * screenSize.first;
interfaces.surface->drawOutlinedCircle(screenSize.first / 2, screenSize.second / 2, radius, 100);
}
}
now this should be works normally with scopes Edit:Updated again. Edit2: Tested - now works correctry with 1x scope and 2x scope
Thank you for this nice tutorial but I get some errors :( like Error Code C2027
I've basically did everything right I guess
And is that on purpose ? " miscJson["Draw FOV"] = misc.watermark; " and not " miscJson["Draw FOV"] = misc.drawFOV; "
oops, corrected everything
I have 15 Errors with the surface :D
🤔 can you show errors?
Yeah but they're german :D https://imgur.com/a/3xD7FAi
add this in include section
#include "../SDK/Surface.h"
Very nice, Thank you <3
element class "Config :: Misc" does not have the "drawFOV" component
Ok nvm.
'DEG2RAD': identifier not found
- (compiling source file Hacks\Misc.cpp)
- (compiling source file GUI.cpp)
- (compiling source file Hooks.cpp)
Maybe there's a piece of code missing?
@4lb3 look at 1 post.
@4lb3 look at 1 post.
I'm sorry, I need glasses.
Using a lambda expressions instead of defines
constexpr void drawFov() noexcept
{
if (config.misc.drawFOV && interfaces.engine->isInGame()) {
auto local = interfaces.entityList->getEntity(interfaces.engine->getLocalPlayer());
if (!local || !local->isAlive()) return;
if (!local->getActiveWeapon()) return;
int weaponId = getWeaponIndex(local->getActiveWeapon()->getProperty<WeaponId>("m_iItemDefinitionIndex"));
if (!config.aimbot[weaponId].enabled) weaponId = 0;
if (!config.aimbot[weaponId].enabled) return;
auto screenSize = interfaces.surface->getScreenSize();
if (config.aimbot[weaponId].silent) interfaces.surface->setDrawColor(255, 10, 10, 255);
else interfaces.surface->setDrawColor(10, 255, 10, 255);
float radius = std::tan(degreesToRadians(config.aimbot[weaponId].fov) / 2.f) / std::tan(degreesToRadians(actualFov) / 2.f) * screenSize.first;
interfaces.surface->drawOutlinedCircle(screenSize.first / 2, screenSize.second / 2, radius, 100);
}
}