SHARE
TWEET

Untitled

a guest Jan 22nd, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void c_visuals::chams(IMatRenderContext* ctx, const draw_model_state_t& state, const model_render_info_t& info, matrix_t* bone_to_world) noexcept {
  2.    
  3.     if (!config_system.item.vis_chams_vis && !config_system.item.vis_chams_invis)
  4.         return;
  5.  
  6.     auto model_name = interfaces::model_info->get_model_name((model_t*)info.model);
  7.  
  8.     auto local_player = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(interfaces::engine->get_local_player()));
  9.     auto entity = reinterpret_cast<player_t*>(interfaces::entity_list->get_client_entity(info.entity_index));
  10.     if (!local_player || !local_player->is_alive() || !entity)
  11.         return;
  12.  
  13.     static auto draw_model_execute_fn = reinterpret_cast<hooks::draw_model_execute_fn>(hooks::modelrender_hook->get_original(21));
  14.  
  15.     static i_material* mat = nullptr;
  16.     auto def = interfaces::material_system->find_material("mat_default", TEXTURE_GROUP_MODEL, true, nullptr);
  17.     mat = def;
  18.  
  19.     if (strstr(model_name, "models/player")) {
  20.  
  21.         if (entity && entity->is_alive() && !entity->dormant()) {
  22.  
  23.             int i = entity->index();
  24.  
  25.             if (local_player && local_player->is_alive() && entity->team() != local_player->team()) {
  26.                 interfaces::model_render->override_material(mat);
  27.                 interfaces::render_view->modulate_color(config_system.item.clr_chams_vis);
  28.                 interfaces::render_view->set_blend(config_system.item.clr_chams_vis[3]);
  29.                 draw_model_execute_fn(interfaces::model_render, ctx, state, info, bone_to_world);
  30.                 interfaces::model_render->override_material(nullptr);
  31.                 return;
  32.             }
  33.         }
  34.     }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top