Jump to content

help pls hack crash


Recommended Posts

anyone can help me and tell me why debugger say : Run-Time Check Failure #3 - The variable 'bestTargetSimTime' is being used without being initialized.

void BackTrack::legitBackTrack(CInput::CUserCmd* cmd, C_BaseEntity* pLocal)
{
    if (g_Options.Legitbot.backtrack)
    {
        int bestTargetIndex = -1;
        float bestFov = FLT_MAX;
        player_info_t info;
        if (!pLocal->IsAlive())
            return;
 
        for (int i = 0; i < g_Engine->GetMaxClients(); i++)
        {
            auto entity = (C_BaseEntity*)g_EntityList->GetClientEntity(i);
 
            if (!entity || !pLocal)
                continue;
 
            if (entity == pLocal)
                continue;
 
            if (!g_Engine->GetPlayerInfo(i, &info))
                continue;
 
            if (entity->IsDormant())
                continue;
 
            if (entity->GetTeamNum() == pLocal->GetTeamNum())
                continue;
 
            if (entity->IsAlive())
            {
 
                float simtime = entity->GetSimulationTime();
                Vector hitboxPos = GetHitboxPosition(entity, 0);
 
                headPositions[i][cmd->command_number % 13] = backtrackData{ simtime, hitboxPos };
                Vector ViewDir = angle_vector(cmd->viewangles + (pLocal->localPlayerExclusive()->GetAimPunchAngle() * 2.f));
                float FOVDistance = distance_point_to_line(hitboxPos, pLocal->GetEyePosition(), ViewDir);
 
                if (bestFov > FOVDistance)
                {
                    bestFov = FOVDistance;
                    bestTargetIndex = i;
                }
            }
        }
 
        float bestTargetSimTime;
        if (bestTargetIndex != -1)
        {
            float tempFloat = FLT_MAX;
            Vector ViewDir = angle_vector(cmd->viewangles + (pLocal->localPlayerExclusive()->GetAimPunchAngle() * 2.f));
            for (int t = 0; t < g_Options.Legitbot.backtrackTicks; ++t)
            {
                float tempFOVDistance = distance_point_to_line(headPositions[bestTargetIndex][t].hitboxPos, pLocal->GetEyePosition(), ViewDir);
                if (tempFloat > tempFOVDistance && headPositions[bestTargetIndex][t].simtime > pLocal->GetSimulationTime() - 1)
                {
                    tempFloat = tempFOVDistance;
                    bestTargetSimTime = headPositions[bestTargetIndex][t].simtime;
                }
            }
 
            cmd->tick_count = TIME_TO_TICKS(bestTargetSimTime);
        }
    }
}
 
BackTrack* backtracking = new BackTrack();
backtrackData headPositions[64][12];

and this line show the debugger : cmd->tick_count = TIME_TO_TICKS(bestTargetSimTime);

Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...