-
Автор темы
- #1
Помогите нн-пастеру с кодом.
Я не могу понять как добавить Grenade warning.
А именно:
И
Я не могу понять как добавить Grenade warning.
C++:
void DrawBeamPaw(Vector src, Vector end, Color color)
{
BeamInfo_t beamInfo;
beamInfo.m_nType = TE_BEAMPOINTS; //TE_BEAMPOINTS
beamInfo.m_vecStart = src;
beamInfo.m_vecEnd = end;
beamInfo.m_pszModelName = "sprites/glow01.vmt";
beamInfo.m_pszHaloName = "sprites/glow01.vmt";
beamInfo.m_flHaloScale = 3.0;
beamInfo.m_flWidth = 4.5f;
beamInfo.m_flEndWidth = 4.5f;
beamInfo.m_flFadeLength = 0.5f;
beamInfo.m_flAmplitude = 0;
beamInfo.m_flBrightness = 255.f;
beamInfo.m_flSpeed = 0.0f;
beamInfo.m_nStartFrame = 0.0;
beamInfo.m_flFrameRate = 0.0;
beamInfo.m_flRed = color.r();
beamInfo.m_flGreen = color.g();
beamInfo.m_flBlue = color.b();
beamInfo.m_nSegments = 2;
beamInfo.m_bRenderable = true;
beamInfo.m_flLife = 1;
beamInfo.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM | FBEAM_ENDVISIBLE; //FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM
Beam_t* myBeam = m_viewrenderbeams()->CreateBeamPoints(beamInfo);
if (myBeam)
m_viewrenderbeams()->DrawBeam(myBeam);
}
void worldesp::grenade_projectiles(entity_t* entity)
{
if (!g_cfg.esp.projectiles)
return;
auto client_class = entity->GetClientClass();
if (!client_class)
return;
auto model = entity->GetModel();
if (!model)
return;
float rainbow = 0.f;
if (rainbow <= 1.f)
rainbow += 0.0001;
rainbow = 0.f;
return;
auto studio_model = m_modelinfo()->GetStudioModel(model);
if (!studio_model)
return;
auto name = (std::string)studio_model->szName;
if (name.find("thrown") != std::string::npos ||
client_class->m_ClassID == CBaseCSGrenadeProjectile || client_class->m_ClassID == CDecoyProjectile || client_class->m_ClassID == CMolotovProjectile)
{
auto grenade_origin = entity->GetAbsOrigin();
auto grenade_position = ZERO;
if (!math::world_to_screen(grenade_origin, grenade_position))
return;
std::string grenade_warning;
auto distance = g_ctx.local()->GetAbsOrigin().DistTo(grenade_origin) / 12.0f;
auto rainbow_col = Color::FromHSB(rainbow, 1, 1);
DrawBeamPaw(grenade_origin, Vector(grenade_origin.x, grenade_origin.y + 10, grenade_origin.z), rainbow_col);
return;
std::string grenade_name, grenade_icon;
if (name.find("flashbang") != std::string::npos)
{
grenade_name = "FLASHBANG";
grenade_icon = "i";
}
else if (name.find("smokegrenade") != std::string::npos)
{
grenade_name = "SMOKE";
grenade_icon = "k";
}
else if (name.find("incendiarygrenade") != std::string::npos)
{
grenade_name = "INCENDIARY";
grenade_icon = "n";
}
else if (name.find("molotov") != std::string::npos)
{
grenade_name = "MOLOTOV";
grenade_icon = "l";
}
else if (name.find("fraggrenade") != std::string::npos)
{
grenade_name = "HE GRENADE";
grenade_icon = "j";
}
else if (name.find("decoy") != std::string::npos)
{
grenade_name = "DECOY";
grenade_icon = "m";
}
else
return;
Box box;
if (util::get_bbox(entity, box, false))
{
if (g_cfg.esp.grenade_esp[GRENADE_BOX])
{
render::get().rect(box.x, box.y, box.w, box.h, g_cfg.esp.grenade_box_color);
if (g_cfg.esp.grenade_esp[GRENADE_ICON])
render::get().text(fonts[GRENADES], box.x + box.w / 2, box.y - 21, g_cfg.esp.projectiles_color, HFONT_CENTERED_X, grenade_icon.c_str());
if (g_cfg.esp.grenade_esp[GRENADE_TEXT])
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h + 2, g_cfg.esp.projectiles_color, HFONT_CENTERED_X, grenade_name.c_str());
}
else
{
if (g_cfg.esp.grenade_esp[GRENADE_ICON] && g_cfg.esp.grenade_esp[GRENADE_TEXT])
{
render::get().text(fonts[GRENADES], box.x + box.w / 2, box.y + box.h / 2 - 10, g_cfg.esp.projectiles_color, HFONT_CENTERED_X, grenade_icon.c_str());
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h / 2 + 7, g_cfg.esp.projectiles_color, HFONT_CENTERED_X, grenade_name.c_str());
}
else
{
if (g_cfg.esp.grenade_esp[GRENADE_ICON])
render::get().text(fonts[GRENADES], box.x + box.w / 2, box.y + box.h / 2, g_cfg.esp.projectiles_color, HFONT_CENTERED_X | HFONT_CENTERED_Y, grenade_icon.c_str());
if (g_cfg.esp.grenade_esp[GRENADE_TEXT])
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h / 2, g_cfg.esp.projectiles_color, HFONT_CENTERED_X | HFONT_CENTERED_Y, grenade_name.c_str());
}
}
}
}
else
{
auto model = entity->GetModel();
if (!model)
return;
auto studio_model = m_modelinfo()->GetStudioModel(model);
if (!studio_model)
return;
auto name = (std::string)studio_model->szName;
if (name.find("dropped") != std::string::npos)
{
auto weapon = (weapon_t*)entity; //-V1027
Box box;
if (util::get_bbox(weapon, box, false))
{
auto offset = 0;
if (g_cfg.esp.weapon[WEAPON_BOX])
{
render::get().rect(box.x, box.y, box.w, box.h, g_cfg.esp.box_color);
if (g_cfg.esp.weapon[WEAPON_ICON])
{
render::get().text(fonts[SUBTABWEAPONS], box.x + box.w / 2, box.y - 14, g_cfg.esp.weapon_color, HFONT_CENTERED_X, weapon->get_icon());
offset = 14;
}
if (g_cfg.esp.weapon[WEAPON_TEXT])
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h + 2, g_cfg.esp.weapon_color, HFONT_CENTERED_X, weapon->get_name().c_str());
if (g_cfg.esp.weapon[WEAPON_DISTANCE])
{
auto distance = g_ctx.local()->GetAbsOrigin().DistTo(weapon->GetAbsOrigin()) / 12.0f;
render::get().text(fonts[ESP], box.x + box.w / 2, box.y - 13 - offset, g_cfg.esp.weapon_color, HFONT_CENTERED_X, "%i FT", (int)distance);
}
}
else
{
if (g_cfg.esp.weapon[WEAPON_ICON])
render::get().text(fonts[SUBTABWEAPONS], box.x + box.w / 2, box.y + box.h / 2 - 7, g_cfg.esp.weapon_color, HFONT_CENTERED_X, weapon->get_icon());
if (g_cfg.esp.weapon[WEAPON_TEXT])
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h / 2 + 6, g_cfg.esp.weapon_color, HFONT_CENTERED_X, weapon->get_name().c_str());
if (g_cfg.esp.weapon[WEAPON_DISTANCE])
{
auto distance = g_ctx.local()->GetAbsOrigin().DistTo(weapon->GetAbsOrigin()) / 12.0f;
if (g_cfg.esp.weapon[WEAPON_ICON] && g_cfg.esp.weapon[WEAPON_TEXT])
offset = 21;
else if (g_cfg.esp.weapon[WEAPON_ICON])
offset = 21;
else if (g_cfg.esp.weapon[WEAPON_TEXT])
offset = 8;
render::get().text(fonts[ESP], box.x + box.w / 2, box.y + box.h / 2 - offset, g_cfg.esp.weapon_color, HFONT_CENTERED_X, "%i FT", (int)distance);
}
}
}
}
}
}
C++:
void DrawBeamPaw(Vector src, Vector end, Color color)
{
BeamInfo_t beamInfo;
beamInfo.m_nType = TE_BEAMPOINTS; //TE_BEAMPOINTS
beamInfo.m_vecStart = src;
beamInfo.m_vecEnd = end;
beamInfo.m_pszModelName = "sprites/glow01.vmt";
beamInfo.m_pszHaloName = "sprites/glow01.vmt";
beamInfo.m_flHaloScale = 3.0;
beamInfo.m_flWidth = 4.5f;
beamInfo.m_flEndWidth = 4.5f;
beamInfo.m_flFadeLength = 0.5f;
beamInfo.m_flAmplitude = 0;
beamInfo.m_flBrightness = 255.f;
beamInfo.m_flSpeed = 0.0f;
beamInfo.m_nStartFrame = 0.0;
beamInfo.m_flFrameRate = 0.0;
beamInfo.m_flRed = color.r();
beamInfo.m_flGreen = color.g();
beamInfo.m_flBlue = color.b();
beamInfo.m_nSegments = 2;
beamInfo.m_bRenderable = true;
beamInfo.m_flLife = 1;
beamInfo.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM | FBEAM_ENDVISIBLE; //FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM
Beam_t* myBeam = m_viewrenderbeams()->CreateBeamPoints(beamInfo);
if (myBeam)
m_viewrenderbeams()->DrawBeam(myBeam);
}
C++:
auto distance = g_ctx.local()->GetAbsOrigin().DistTo(grenade_origin) / 12.0f;
auto rainbow_col = Color::FromHSB(rainbow, 1, 1);
DrawBeamPaw(grenade_origin, Vector(grenade_origin.x, grenade_origin.y + 10, grenade_origin.z), rainbow_col);