Newbie HvHer
- User ID
- 21982
- Messages
- 1
- Reactions
- 0
- Level
- 1
Hi guys, i have a problem with my SimulateFireBullet function, for some reason that i dont know, the function dont pass this part making my damage always getting 0, i dont know why, i already searched in all internet, other sources, i already tried to remake these function and nothing, always returns here, someone know why?
SimulateFireBullet Problem Lines:
trace_line function:
ClipTraceToPlayers Function:
i dont know what can i do more to made this function works!
SimulateFireBullet Problem Lines:
Code:
trace_line(data.src, end, MASK_SHOT_HULL | CONTENTS_HITBOX, &filter, &data.enter_trace);
ClipTraceToPlayers(player, data.src, end + data.direction * 40.f, MASK_SHOT_HULL, &data.filter, &data.enter_trace);
g_CVar->ConsolePrintf("SFB 4\n");
if (data.enter_trace.fraction == 1.0f)
{
if (player && !(player->m_fFlags() & FL_ONGROUND))
{
data.enter_trace.hitgroup = GetHitgroup(hitbox);
data.enter_trace.hit_entity = player;
}
else
break;
}
trace_line function:
Code:
void trace_line(Vector& start, Vector& end, unsigned int mask, CTraceFilter* filter, CGameTrace* tr)
{
Ray_t ray;
ray.Init(start, end);
g_EngineTrace->TraceRay(ray, mask, filter, tr);
}
ClipTraceToPlayers Function:
Code:
trace_t playerTrace;
Ray_t ray;
float smallestFraction = tr->fraction;
const float maxRange = 60.0f;
ray.Init(start, end);
if (!player || !player->IsAlive() || player->IsDormant())
return;
if (filter && filter->ShouldHitEntity(player, mask) == false)
return;
float range = DistanceToRay(player->WorldSpaceCenter(), start, end);
if (range < 0.0f || range > maxRange)
return;
g_EngineTrace->ClipRayToEntity(ray, mask | CONTENTS_HITBOX, player, tr);
i dont know what can i do more to made this function works!