Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void c_eventlistener::FireGameEvent(IGameEvent* e) {
- if (!e)
- return;
- auto event_name = std::string(e->GetName());
- auto localplayer = g_game->interfaces->engine->get_local_player();
- auto cfg = c_config::get();
- if (event_name == _("bullet_impact")) {
- auto x = e->get_float(_("x"));
- auto y = e->get_float(_("y"));
- auto z = e->get_float(_("z"));
- auto userid = e->get_int(_("userid"));
- if (cfg->b[_("vis_bulletimpacts")])
- g_game->interfaces->overlay->add_box_overlay(Vector(x, y, z), Vector(-2, -2, -2), Vector(2, 2, 2), Vector(0, 0, 0), 0, 0, 255, 127, 4);
- last_bullet_impact = Vector(x, y, z);
- auto entid = g_game->interfaces->engine->get_player_for_userid(userid);
- auto uent = g_game->interfaces->entities->from_num(entid);
- if (uent) {
- auto ent = uent->get_base_entity();
- auto eyes = ent->m_vecOrigin() + ent->m_vecViewOffset();
- if (ent->entindex() == g_globals->local_player->entindex() && (cfg->b[_("vis_local_tracer")] || cfg->b[_("vis_team_tracer")])) {
- Ray_t raycast;
- raycast.init(eyes, Vector(x, y, z));
- CTraceFilter filter;
- filter.skip = g_globals->local_player;
- trace_t tr;
- g_game->interfaces->trace->trace_ray(raycast, MASK_SHOT | CONTENTS_GRATE, &filter, &tr);
- if (tr.ent && cfg->b[_("vis_team_tracer")])
- c_tracers::get()->add(
- Vector(eyes.x, eyes.y, eyes.z - 2.f),
- Vector(x, y, z),
- cfg->imcolor_to_ccolor(cfg->c[_("vis_team_tracer_color")]));
- else if (!tr.ent && cfg->b[_("vis_local_tracer")])
- c_tracers::get()->add(
- Vector(eyes.x, eyes.y, eyes.z - 2.f),
- Vector(x, y, z),
- cfg->imcolor_to_ccolor(cfg->c[_("vis_local_tracer_color")]));
- }
- else {
- if (ent->m_iTeamNum() != g_globals->local_player->m_iTeamNum() && cfg->b[_("vis_enemy_tracer")])
- c_tracers::get()->add(
- Vector(eyes.x, eyes.y, eyes.z - 2.f),
- Vector(x, y, z),
- cfg->imcolor_to_ccolor(cfg->c[_("vis_enemy_tracer_color")]));
- }
- }
- }
- if (event_name == _("player_hurt")) {
- auto userid = e->get_int(_("userid"));
- auto attacker = e->get_int(_("attacker"));
- auto health = e->get_int(_("health"));
- auto armor = e->get_int(_("armor"));
- auto weapon = e->get_string(_("weapon"));
- auto dmg_health = e->get_int(_("dmg_health"));
- auto dmg_armor = e->get_int(_("dmg_armor"));
- auto hitgroup = e->get_int(_("hitgroup"));
- auto ent_hurted = g_game->interfaces->engine->get_player_for_userid(userid);
- auto ent_attacker = g_game->interfaces->engine->get_player_for_userid(attacker);
- if (ent_hurted != ent_attacker) {
- player_info_t p_hurted, p_attacker;
- g_game->interfaces->engine->get_player_info(ent_hurted, &p_hurted);
- g_game->interfaces->engine->get_player_info(ent_attacker, &p_attacker);
- if (ent_hurted == localplayer && cfg->b[_("misc_logevents")] && cfg->b[_("misc_showdamage")])
- c_utils::get()->log(_(" -%ihp in the %s by %s (%s)"), dmg_health, hitgroup_to_string(hitgroup).c_str(), p_attacker.name, weapon);
- if (ent_attacker == localplayer) {
- if (cfg->b[_("misc_logevents")] && cfg->b[_("misc_showdamage")])
- // c_utils::get()->log(_("Hit %s in the %s for %ihp (%ihp left)"), p_hurted.name, hitgroup_to_string(hitgroup).c_str(), dmg_health, health);
- c_utils::get()->log(_("-%ihp in %s to %s (%ihp left)"), dmg_health, hitgroup_to_string(hitgroup).c_str(), p_hurted.name, health);
- if (cfg->i[_("vis_hitsound")]) {
- if (cfg->i[_("vis_hitsound")] == 1)
- g_game->interfaces->engine->client_cmd_unrestricted(_("play weapons/auto_semiauto_switch"));
- if (cfg->i[_("vis_hitsound")] == 2)
- g_game->interfaces->engine->client_cmd_unrestricted(_("play buttons/arena_switch_press_02"));
- }
- if (cfg->m[_("vis_hitmarker")][0])
- c_hitmarker::get()->add_screen_marker();
- if (cfg->m[_("vis_hitmarker")][1])
- c_hitmarker::get()->add_positional_marker(last_bullet_impact);
- if (health <= 0 && cfg->i[_("vis_killeffect")] == 1)
- g_globals->killeffect_alpha = (int)(cfg->c[_("vis_killeffect_color")][3] * 255.f);
- if (health <= 0 && cfg->i[_("vis_killeffect")] == 2)
- g_globals->local_player->m_flHealthShotBoostExpirationTime() = g_game->interfaces->globals->curtime + cfg->f[_("vis_killeffect_length")];
- }
- }
- }
- if (event_name == _("player_blind")) {
- auto attacker = e->get_int(_("attacker"));
- auto userid = e->get_int(_("userid"));
- auto ent_attacker = g_game->interfaces->engine->get_player_for_userid(attacker);
- auto ent_userid = g_game->interfaces->engine->get_player_for_userid(userid);\
- if (ent_attacker == localplayer) {
- if (cfg->i[_("vis_hitsound")]) {
- if (cfg->i[_("vis_hitsound")] == 1)
- g_game->interfaces->engine->client_cmd_unrestricted(_("play weapons/auto_semiauto_switch"));
- if (cfg->i[_("vis_hitsound")] == 2)
- g_game->interfaces->engine->client_cmd_unrestricted(_("play buttons/arena_switch_press_02"));
- }
- }
- }
- if (event_name == _("game_newmap")) {
- g_globals->reset_smoke = true;
- g_globals->reset_alpha = true;
- g_globals->reset_sky = true;
- g_globals->reset_impacts = true;
- }
- if (event_name == _("player_footstep")) {
- if (cfg->b[_("vis_soundesp")]) {
- auto uid = e->get_int(_("userid"));
- auto ent = (C_BaseEntity*)g_game->interfaces->entities->from_num(g_game->interfaces->engine->get_player_for_userid(uid));
- if (ent) {
- if (ent->entindex() != g_globals->local_player->entindex() && ent->m_iTeamNum() != g_globals->local_player->m_iTeamNum()) {
- auto col = cfg->c[_("vis_soundesp_color")];
- g_game->interfaces->overlay->add_text_rgb(ent->m_vecOrigin(), 0, 1.5f, col[0], col[1], col[2], col[3], _("STEP"));
- }
- }
- }
- }
- if (event_name == _("round_start")) {
- for (int i = 1; i < g_game->interfaces->globals->maxclients; i++) {
- auto ent = (C_BaseEntity*)g_game->interfaces->entities->from_num(i);
- if (ent)
- ent->m_hObserverTarget() = CBaseHandle();
- }
- for (auto& p : c_esp::get()->players) {
- p.second.alpha = 0;
- p.second.alpha_anim = 0;
- }
- }
- if (event_name == "player_death") {
- auto userid = e->get_int("userid");
- auto ent = (C_BaseEntity*)g_game->interfaces->entities->from_num(g_game->interfaces->engine->get_player_for_userid(userid));
- if (ent) {
- ent->m_iHealth() = 0;
- c_esp::get()->players[ent->entindex()].alpha = 0;
- c_esp::get()->players[ent->entindex()].alpha_anim = 0;
- }
- auto attacker = g_game->interfaces->entities->from_num(g_game->interfaces->engine->get_player_for_userid(e->get_int("attacker")));
- auto group = _("lb_grp_") + std::to_string(c_legitbot::get()->group_id) + _("_");
- if (attacker && g_globals->local_player && attacker->entindex() == g_globals->local_player->entindex() &&
- cfg->i[group + _("switchdelay")] != 0 && cfg->b[group + _("aimbot")] && c_keyhandler::get()->auto_check(group + _("aimbot_key"))) {
- c_legitbot::get()->shot_delay += g_globals->local_player->m_flSimulationTime() + cfg->i[group + _("switchdelay")] * 0.001f;
- }
- }
- if (c_config::get()->b[_("lua_devmode")])
- c_utils::get()->log(event_name.c_str());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement