![](https://ucp-anticheat.org/images/kv.png) CSGO: Defusing warning
I mean there is only so much I can do wrong…
How I try to draw that shit:
void Visuals::RenderDefuseWarning(C_BaseEntity *Testing)
{
for (int i = 0; i < g_EntityList->GetHighestEntityIndex(); i++)
{
if (Testing->IsPlantedC4())
{
DrawString(watermark_font, 10, 25, Color(0, 162, 232, 255), FONT_LEFT, "Bomb Planted");
C_BaseEntity *entity = (C_BaseEntity*)g_EntityList->GetClientEntity(i);
if (entity == nullptr)
continue;
if (entity == Testing)
continue;
if (entity->IsDormant())
continue;
CCSBomb* Bomb = (CCSBomb*)entity;
float flBlow = Bomb->GetC4BlowTime();
float lifetime = flBlow - (g_GlobalVars->interval_per_tick * Testing->GetTickBase());
char LifetimeTimeString[24];
sprintf_s(LifetimeTimeString, sizeof(LifetimeTimeString) - 1, "Bomb: %.1f", lifetime);
DrawString(watermark_font, 10, 10, Color(0, 162, 232, 255), FONT_LEFT, LifetimeTimeString);
if (Bomb->GetBombDefuser() > 0)
{
DrawString(watermark_font, 10, 40, Color(0, 162, 232, 255), FONT_LEFT, "Defusing");
float countdown = Bomb->GetC4DefuseCountdown() - (AimRage::Get().GetTickbase() *g_GlobalVars->interval_per_tick);
if (countdown > 0.01f)
{
if (lifetime > countdown)
{
char defuseTimeString[24];
sprintf_s(defuseTimeString, sizeof(defuseTimeString) - 1, "Defusing: %.1f", countdown);
DrawString(watermark_font, 10, 10, Color(0, 162, 232, 255), FONT_LEFT, defuseTimeString);
}
else
{
DrawString(watermark_font, 10, 10, Color(0, 162, 232, 255), FONT_LEFT, "NO TIME BLYAT");
}
}
}
}
}
}
bool C_BaseEntity::IsPlantedC4()
{
return GetClientClass()->m_ClassID == ClassId_CPlantedC4;
}
That part is working now just the values which I get back from my Netvars are completely off.
My Bomb class:
class CCSBomb
{
public:
float GetC4BlowTime()
{
return *(float*)((uintptr_t)this + NetMngr::Get().getOffs("DT_PlantedC4", "m_flC4Blow"));
}
float GetC4DefuseCountdown()
{
return *(float*)((uintptr_t)this + NetMngr::Get().getOffs("DT_PlantedC4", "m_flDefuseCountDown"));
}
int GetBombDefuser()
{
return *(int*)((uintptr_t)this + NetMngr::Get().getOffs("DT_PlantedC4", "m_hBombDefuser"));
}
bool IsBombDefused()
{
return *(bool*)((uintptr_t)this + NetMngr::Get().getOffs("DT_PlantedC4", "m_bBombDefused"));
}
};
|