nixware.cc
-
Автор темы
- #1
Walkbot.cpp
Walkbot.h
createmove
В меню:
Код:
#include "WalkBot.h"
static unsigned int rally;
static bool reachedEnd;
static bool hasAutobought;
static bool hasDied;
bool slowLastTick = false;
const std::vector<Vector> tRallyPoints = { Vector(-503.56f, -739.92f, 114.16f),
Vector(-1913.50f,-735.72f, 121.20f),Vector(-1676.94f, 726.70f, 31.00f),
Vector(-1655.66f,1053.87f,31.57f), Vector(-1989.64f,1330.22f,28.93f),Vector(-1926.35f,2197.58f,-3.22f), Vector(-1685.82,2231.82,-2.47),
Vector(-1331.98f,2231.99f,2.05f), Vector(-1286.65f,2164.06f,4.25f),Vector(-606.69f,2370.25f,-105.67f),
Vector(-429.61f, 2196.21f, -123.86),Vector(279.11f,2175.06f,-128.18f),Vector(1380.f, 2131.6f, -5.48f),
Vector(1398.04f, 928.93f, -8.78f), Vector(841.17f, 950.18f, 0.14f),Vector(581.58f, 674.48f, 1.50f) ,
Vector(690.59f, 345.20f, 1.54f), Vector(446.82f, 70.25f, -3.26f), Vector(-5.52f, -829.16f, -3.58f)
};
const std::vector<Vector> ctRallyPoints = { Vector(279.11f,2175.06f,-128.18f),
Vector(1380.f, 2131.6f, -5.48f), Vector(1398.04f, 928.93f, -8.78f), Vector(841.17f, 950.18f, 0.14f),
Vector(581.58f, 674.48f, 1.50f) , Vector(690.59f, 345.20f, 1.54f), Vector(446.82f, 70.25f, -3.26f),
Vector(-5.52f, -829.16f, -3.58f), Vector(-503.56f, -739.92f, 114.16f), Vector(-1913.50f,-735.72f, 121.20f),
Vector(-1676.94f, 726.70f, 31.00f), Vector(-1655.66f,1053.87f,31.57f), Vector(-1989.64f,1330.22f,28.93f),
Vector(-1926.35f,2197.58f,-3.22f), Vector(-1331.98f,2231.99f,2.05f), Vector(-1286.65f,2164.06f,4.25f),
Vector(-606.69f,2370.25f,-105.67f),Vector(-429.61f, 2196.21f, -123.86) };
void inline Reset()
{
if (reachedEnd || forceReset || hasDied) {
rally = 0;
reachedEnd = false;
forceReset = false;
hasDied = false;
}
}
bool DoRally(const std::vector<Vector> points, CUserCmd *cmd) // return true if rally is completed.
{
CBaseEntity* localPlayer = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(Interfaces::Engine()->GetLocalPlayer());
if (reachedEnd)
return true;
if ((std::abs(localPlayer->GetEyePosition().x - points[rally].x) < 0.6f) &&
(std::abs(localPlayer->GetEyePosition().y - points[rally].y) < 0.6f)) {
if (rally == points.size() - 1)
{
if (!reachedEnd)
{
reachedEnd = true;
}
return true; // Finished Walking
}
rally++;
}
Vector move = CalcAngle2(localPlayer->GetEyePosition(), points[rally]);
cmd->forwardmove = 250.0f;
cmd->sidemove = 0;
cmd->buttons |= IN_WALK;
CorrectMovement(move, cmd, cmd->forwardmove, cmd->sidemove);
return false;
}
void Walkbot::CreateMove(CUserCmd *cmd)
{
CBaseEntity* localPlayer = (CBaseEntity*)Interfaces::EntityList()->GetClientEntity(Interfaces::Engine()->GetLocalPlayer());
if (!localPlayer || !Interfaces::Engine()->IsInGame() || forceReset) {
Reset();
return;
}
if (!enabled) {
return;
}
if (localPlayer->m_bGunGameImmunity())
{
Reset();
if (autobuy && !hasAutobought && (localPlayer->GetMoney() >= autobuyAt))
{
Interfaces::Engine()->ExecuteClientCmd("autobuy");
hasAutobought = true;
}
}
if (false)//
{
slowLastTick = true;
return;
}
else if (slowLastTick) {
slowLastTick = false;
return;
}
int ourTeam = localPlayer->GetTeamNum();
if (!localPlayer->IsAlive())
{
if (ourTeam == 0)
{
Interfaces::Engine()->ExecuteClientCmd("teammenu"); // this will trigger the auto select timer
return;
}
else
{
hasDied = true;
hasAutobought = false;
return;
}
}
if (ourTeam == 2)
{
DoRally(tRallyPoints, cmd);
}
else if (ourTeam == 3)
{
DoRally(ctRallyPoints, cmd);
}
}
Код:
#pragma once
#include "Engine/Engine.h"
#include <vector>
namespace Walkbot
{
enum class TeamID : int
{
TEAM_UNASSIGNED,
TEAM_SPECTATOR,
TEAM_TERRORIST,
TEAM_COUNTER_TERRORIST,
};
//Hooks
void CreateMove(CUserCmd* cmd);
}
Код:
Walkbot::CreateMove(cmd);
Код:
ImGui::Text("Dust 2 Walkbot");
ImGui::Checkbox("Enable", &enabled);
ImGui::SameLine();
if (ImGui::Button("Reset")) {
forceReset = true;
}
ImGui::Separator();
ImGui::Checkbox("Autobuy", &autobuy);
ImGui::SameLine();
ImGui::SliderInt("", &autobuyAt, 0, 16000, "Autobuy At $%0.f");