fnx Posted February 15, 2020 Share Posted February 15, 2020 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); Quote Link to comment Share on other sites More sharing options...
fnx Posted February 22, 2020 Author Share Posted February 22, 2020 fixed Quote Link to comment Share on other sites More sharing options...
cicin Posted May 5, 2020 Share Posted May 5, 2020 at least tell us how you did it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.