Начинающий
-
Автор темы
- #1
https://i.imgur.com/xLmgqTG.png [/ IMG]
[IMG] https://i.imgur.com/z2G2vjl.png [/ IMG]
first image is what happens in first person
second image is what happens in third person
[CODE]
int attackerid = game_event-> GetInt ("attacker");
int user = game_event-> GetInt ("userid");
auto entity = interfaces.ent_list-> GetClientEntity (interfaces.engine-> GetPlayerForUserID (user));
int entityid = interfaces.engine-> GetPlayerForUserID (attackerid);
if (entityid == interfaces.engine-> GetLocalPlayer () && user! = interfaces.engine-> GetPlayerForUserID (interfaces.engine-> GetLocalPlayer ()))
{
matrix tmp_matrix [128];
matrices_s matrixStruct;
bool valid = entity-> GetRagdollPos () == Vector (0, 0, 0);
if (entity-> SetupBones (tmp_matrix, 128, 0x7FF00, interfaces.global_vars-> curtime) && entity-> isAlive ()) {
memcpy (matrixStruct.matrix, tmp_matrix, sizeof (tmp_matrix));
matrixStruct.flDisplayTime = interfaces.global_vars-> curtime;
matrixStruct.valid = valid;
matrixStruct.entity = entity;
csgo-> m_vecMatrices.push_back (matrixStruct);
}
}
} [/ CODE]
^ code in my player_hurt
[CODE] struct matrices_s
{
matrix matrix [128];
IBasePlayer * entity;
bool valid;
float flDisplayTime; // for how long it will stay (do gpGlobals-> curtime + 5.f and then check if
// curtime> = flDisplayTime
}; [/ CODE] ^ matrices in my cMainStruct header
[CODE] std :: vector <matrices_s> m_vecMatrices; [/ CODE] ^ creation of m_vecMatrices
[CODE] oid __fastcall Hooked_DrawModelExecute (void * thisptr, int edx, void * ctx, void * state, const ModelRenderInfo_t & info, matrix * pCustomBoneToWorld)
{
static auto DrawModelExecute = g_pModelRenderHook-> GetOriginal <DrawModelExecuteFn> (21);
/ * if (interfaces.models.model_render-> IsForcedMaterialOverride ()) {
return DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
} * /
if (csgo-> DoUnload)
return DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
static bool fl = false;
if (! fl)
{
std :: ofstream ("csgo \\ materials \\ regular_glow.vmt") << R "# (" VertexLitGeneric "{
"$ additive" "1"
"$ envmap" "models / effects / cube_white"
"$ envmaptint" "[1 1 1]"
"$ envmapfresnel" "1"
"$ envmapfresnelminmaxexp" "[0 1 2]"
"$ alpha" "1"
}) # ";
std :: ofstream ("csgo \\ materials \\ regular_ref.vmt") << R "# (" VertexLitGeneric "{
"$ basetexture" "vgui / white"
"$ envmap" "env_cubemap"
"$ envmaptint" "[.10 .10 .10]"
"$ pearlescent" "0"
"$ phong" "1"
"$ phongexponent" "10"
"$ phongboost" "1.0"
"$ rimlight" "1"
"$ rimlightexponent" "1"
"$ rimlightboost" "1"
"$ model" "1"
"$ nocull" "0"
"$ halflambert" "1"
"$ lightwarptexture" "metalic"
}) # ";
fl = true;
}
if (interfaces.engine-> IsInGame () && csgo-> local && info.pModel)
{
const auto mN = info.pModel-> name / * interfaces.models.model_info-> GetModelName (info.pModel) * /;
}
const auto ModelName = info.pModel-> name;
static IMaterial * Glow = interfaces.material_system-> FindMaterial (hs :: glow_armsrace :: s (). c_str (), nullptr);
static IMaterial * GlowFade = interfaces.material_system-> FindMaterial (hs :: regular_glow :: s (). c_str (), nullptr);
static IMaterial * ShotOverlayMaterial = nullptr;
static IMaterial * ShotOverridedMaterial = nullptr;
switch (vars.visuals.shot_overlay)
{
case 1: ShotOverlayMaterial = Glow; break;
case 2: ShotOverlayMaterial = GlowFade; break;
}
if (strstr (ModelName, "player /")! = nullptr)
if (csgo-> local) {
if (vars.visuals.shot_chams &&! csgo-> m_vecMatrices.empty ()) {
for (size_t i = 0; i <csgo-> m_vecMatrices.size (); i ++)
{
if (csgo-> m_vecMatrices [i] .flDisplayTime + 5.f <interfaces.global_vars-> curtime)
csgo-> m_vecMatrices.erase (csgo-> m_vecMatrices.begin () + i);
/ * ShotOverlayMaterial-> ColorModulate (
vars.visuals.shot_chams_color [0] / 255.f,
vars.visuals.shot_chams_color [1] / 255.f,
vars.visuals.shot_chams_color [2] / 255.f); * /
auto var = ShotOverlayMaterial-> FindVar (hs :: envmaptint :: s (). c_str (), nullptr);
var-> SetVecValue (vars.visuals.shot_chams_color [0] / 255.f,
vars.visuals.shot_chams_color [1] / 255.f, vars.visuals.shot_chams_color [2] / 255.f);
ShotOverlayMaterial-> AlphaModulate (csgo-> m_vecMatrices [i] .flDisplayTime + 5.f - interfaces.global_vars-> curtime);
interfaces.models.model_render-> ForcedMaterialOverride (ShotOverlayMaterial);
DrawModelExecute (interfaces.models.model_render, ctx, state, info, csgo-> m_vecMatrices [i] .matrix);
ShotOverlayMaterial-> IncrementReferenceCount ();
}
// "Un" -force the material after the loop
}
}
DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
interfaces.models.model_render-> ForcedMaterialOverride (nullptr);
} [/ CODE] ^ my entire DME hook
[CODE] g_pModelRenderHook-> Hook (21, Hooked_DrawModelExecute); [/ CODE] ^ where DME is used in Hooks.cpp
I have no clue what the issue is, if you could point me in the right direction that would be greatly appreciated
[IMG] https://i.imgur.com/z2G2vjl.png [/ IMG]
first image is what happens in first person
second image is what happens in third person
[CODE]
int attackerid = game_event-> GetInt ("attacker");
int user = game_event-> GetInt ("userid");
auto entity = interfaces.ent_list-> GetClientEntity (interfaces.engine-> GetPlayerForUserID (user));
int entityid = interfaces.engine-> GetPlayerForUserID (attackerid);
if (entityid == interfaces.engine-> GetLocalPlayer () && user! = interfaces.engine-> GetPlayerForUserID (interfaces.engine-> GetLocalPlayer ()))
{
matrix tmp_matrix [128];
matrices_s matrixStruct;
bool valid = entity-> GetRagdollPos () == Vector (0, 0, 0);
if (entity-> SetupBones (tmp_matrix, 128, 0x7FF00, interfaces.global_vars-> curtime) && entity-> isAlive ()) {
memcpy (matrixStruct.matrix, tmp_matrix, sizeof (tmp_matrix));
matrixStruct.flDisplayTime = interfaces.global_vars-> curtime;
matrixStruct.valid = valid;
matrixStruct.entity = entity;
csgo-> m_vecMatrices.push_back (matrixStruct);
}
}
} [/ CODE]
^ code in my player_hurt
[CODE] struct matrices_s
{
matrix matrix [128];
IBasePlayer * entity;
bool valid;
float flDisplayTime; // for how long it will stay (do gpGlobals-> curtime + 5.f and then check if
// curtime> = flDisplayTime
}; [/ CODE] ^ matrices in my cMainStruct header
[CODE] std :: vector <matrices_s> m_vecMatrices; [/ CODE] ^ creation of m_vecMatrices
[CODE] oid __fastcall Hooked_DrawModelExecute (void * thisptr, int edx, void * ctx, void * state, const ModelRenderInfo_t & info, matrix * pCustomBoneToWorld)
{
static auto DrawModelExecute = g_pModelRenderHook-> GetOriginal <DrawModelExecuteFn> (21);
/ * if (interfaces.models.model_render-> IsForcedMaterialOverride ()) {
return DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
} * /
if (csgo-> DoUnload)
return DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
static bool fl = false;
if (! fl)
{
std :: ofstream ("csgo \\ materials \\ regular_glow.vmt") << R "# (" VertexLitGeneric "{
"$ additive" "1"
"$ envmap" "models / effects / cube_white"
"$ envmaptint" "[1 1 1]"
"$ envmapfresnel" "1"
"$ envmapfresnelminmaxexp" "[0 1 2]"
"$ alpha" "1"
}) # ";
std :: ofstream ("csgo \\ materials \\ regular_ref.vmt") << R "# (" VertexLitGeneric "{
"$ basetexture" "vgui / white"
"$ envmap" "env_cubemap"
"$ envmaptint" "[.10 .10 .10]"
"$ pearlescent" "0"
"$ phong" "1"
"$ phongexponent" "10"
"$ phongboost" "1.0"
"$ rimlight" "1"
"$ rimlightexponent" "1"
"$ rimlightboost" "1"
"$ model" "1"
"$ nocull" "0"
"$ halflambert" "1"
"$ lightwarptexture" "metalic"
}) # ";
fl = true;
}
if (interfaces.engine-> IsInGame () && csgo-> local && info.pModel)
{
const auto mN = info.pModel-> name / * interfaces.models.model_info-> GetModelName (info.pModel) * /;
}
const auto ModelName = info.pModel-> name;
static IMaterial * Glow = interfaces.material_system-> FindMaterial (hs :: glow_armsrace :: s (). c_str (), nullptr);
static IMaterial * GlowFade = interfaces.material_system-> FindMaterial (hs :: regular_glow :: s (). c_str (), nullptr);
static IMaterial * ShotOverlayMaterial = nullptr;
static IMaterial * ShotOverridedMaterial = nullptr;
switch (vars.visuals.shot_overlay)
{
case 1: ShotOverlayMaterial = Glow; break;
case 2: ShotOverlayMaterial = GlowFade; break;
}
if (strstr (ModelName, "player /")! = nullptr)
if (csgo-> local) {
if (vars.visuals.shot_chams &&! csgo-> m_vecMatrices.empty ()) {
for (size_t i = 0; i <csgo-> m_vecMatrices.size (); i ++)
{
if (csgo-> m_vecMatrices [i] .flDisplayTime + 5.f <interfaces.global_vars-> curtime)
csgo-> m_vecMatrices.erase (csgo-> m_vecMatrices.begin () + i);
/ * ShotOverlayMaterial-> ColorModulate (
vars.visuals.shot_chams_color [0] / 255.f,
vars.visuals.shot_chams_color [1] / 255.f,
vars.visuals.shot_chams_color [2] / 255.f); * /
auto var = ShotOverlayMaterial-> FindVar (hs :: envmaptint :: s (). c_str (), nullptr);
var-> SetVecValue (vars.visuals.shot_chams_color [0] / 255.f,
vars.visuals.shot_chams_color [1] / 255.f, vars.visuals.shot_chams_color [2] / 255.f);
ShotOverlayMaterial-> AlphaModulate (csgo-> m_vecMatrices [i] .flDisplayTime + 5.f - interfaces.global_vars-> curtime);
interfaces.models.model_render-> ForcedMaterialOverride (ShotOverlayMaterial);
DrawModelExecute (interfaces.models.model_render, ctx, state, info, csgo-> m_vecMatrices [i] .matrix);
ShotOverlayMaterial-> IncrementReferenceCount ();
}
// "Un" -force the material after the loop
}
}
DrawModelExecute (interfaces.models.model_render, ctx, state, info, pCustomBoneToWorld);
interfaces.models.model_render-> ForcedMaterialOverride (nullptr);
} [/ CODE] ^ my entire DME hook
[CODE] g_pModelRenderHook-> Hook (21, Hooked_DrawModelExecute); [/ CODE] ^ where DME is used in Hooks.cpp
I have no clue what the issue is, if you could point me in the right direction that would be greatly appreciated