├── .gitignore ├── AimBot.cpp ├── Color.cpp ├── ConfigLoader.cpp ├── FloatVector2D.cpp ├── FloatVector3D.cpp ├── Highlight.cpp ├── HighlightList.cpp ├── Level.cpp ├── LocalPlayer.cpp ├── Main.cpp ├── Makefile ├── Memory.cpp ├── NoRecoil.cpp ├── Offsets.cpp ├── Player.cpp ├── README.md ├── Sense.cpp ├── TriggerBot.cpp ├── Util.cpp ├── WeaponId.cpp ├── XDisplay.cpp ├── body_styles.txt ├── border_styles.txt ├── grinder.ini ├── includes.hpp └── key_codes.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | Main 3 | a.out 4 | -------------------------------------------------------------------------------- /AimBot.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct AimBot { 3 | ConfigLoader* cl; 4 | XDisplay* display; 5 | Level* level; 6 | LocalPlayer* localPlayer; 7 | std::vector* players; 8 | Player* target = nullptr; 9 | 10 | AimBot(ConfigLoader* cl, XDisplay* display, Level* level, LocalPlayer* localPlayer, std::vector* players) { 11 | this->cl = cl; 12 | this->display = display; 13 | this->level = level; 14 | this->localPlayer = localPlayer; 15 | this->players = players; 16 | } 17 | 18 | void aimAssist(int counter) { 19 | if (!active()) { releaseTarget(); return; } 20 | if (target == nullptr) assignTarget(); 21 | if (target == nullptr) return; 22 | if (!target->visible) return; 23 | if (target->distance2DToLocalPlayer < util::metersToGameUnits(cl->AIMBOT_MIN_DISTANCE)) return; 24 | if (target->distance2DToLocalPlayer > util::metersToGameUnits(cl->AIMBOT_MAX_DISTANCE)) return; 25 | moveMouse(); 26 | } 27 | 28 | void moveMouse() { 29 | //calculate smoothing 30 | float EXTRA_SMOOTH = cl->AIMBOT_SMOOTH_EXTRA_BY_DISTANCE / target->distanceToLocalPlayer; 31 | float TOTAL_SMOOTH = cl->AIMBOT_SMOOTH + EXTRA_SMOOTH; 32 | //Aimbot calcs 33 | const FloatVector2D aimbotDelta = target->aimbotDesiredAnglesIncrement 34 | .multiply(100) 35 | .divide(TOTAL_SMOOTH); 36 | const double aimYawIncrement = aimbotDelta.y * -1; 37 | const double aimPitchIncrement = aimbotDelta.x; 38 | //combine 39 | const double totalPitchIncrement = aimPitchIncrement; 40 | const double totalYawIncrement = aimYawIncrement; 41 | //turn into integers 42 | int totalPitchIncrementInt = roundHalfEven(atLeast_1_AwayFromZero(totalPitchIncrement)); 43 | int totalYawIncrementInt = roundHalfEven(atLeast_1_AwayFromZero(totalYawIncrement)); 44 | //deadzone - are we close enough yet? 45 | if (fabs(target->aimbotDesiredAnglesIncrement.x) < cl->AIMBOT_DEADZONE) totalPitchIncrementInt = 0; 46 | if (fabs(target->aimbotDesiredAnglesIncrement.y) < cl->AIMBOT_DEADZONE) totalYawIncrementInt = 0; 47 | if (totalPitchIncrementInt == 0 && totalYawIncrementInt == 0) return; 48 | //move mouse 49 | display->moveMouseRelative(totalPitchIncrementInt, totalYawIncrementInt); 50 | } 51 | 52 | bool active() { 53 | bool aimbotIsOn = cl->FEATURE_AIMBOT_ON; 54 | bool combatReady = localPlayer->isCombatReady(); 55 | int weaponId = localPlayer->weaponIndex; 56 | bool weaponDiscarded = localPlayer->weaponDiscarded; 57 | 58 | //only these weapons will use aimbot 59 | bool weaponCanBeAimbotted = ( 60 | weaponId == WEAPON_R301 || 61 | weaponId == WEAPON_FLATLINE || 62 | weaponId == WEAPON_HAVOC || 63 | weaponId == WEAPON_SPITFIRE || 64 | weaponId == WEAPON_RAMPAGE || 65 | weaponId == WEAPON_HEMLOCK || 66 | weaponId == WEAPON_VOLT || 67 | weaponId == WEAPON_LSTAR || 68 | weaponId == WEAPON_DEVOTION || 69 | weaponId == WEAPON_PROWLER || 70 | weaponId == WEAPON_ALTERNATOR || 71 | weaponId == WEAPON_R99 || 72 | weaponId == WEAPON_CAR || 73 | weaponId == WEAPON_P2020 || 74 | weaponId == WEAPON_MOZAMBIQUE || 75 | weaponId == WEAPON_EVA8 || 76 | weaponId == WEAPON_RE45); 77 | 78 | bool activatedByAttackingAndIsAttacking = cl->AIMBOT_ACTIVATED_BY_ATTACK && localPlayer->inAttack; 79 | bool activatedByADSAndIsADSing = cl->AIMBOT_ACTIVATED_BY_ADS && localPlayer->inZoom; 80 | bool activatedByButtonAndButtonIsDown = cl->AIMBOT_ACTIVATED_BY_BUTTON != "" && display->keyDown(cl->AIMBOT_ACTIVATED_BY_BUTTON); 81 | bool active = aimbotIsOn 82 | && combatReady 83 | && !weaponDiscarded 84 | && weaponCanBeAimbotted 85 | && (activatedByAttackingAndIsAttacking 86 | || activatedByADSAndIsADSing 87 | || activatedByButtonAndButtonIsDown); 88 | return active; 89 | } 90 | 91 | void assignTarget() { 92 | for (int i = 0;i < players->size();i++) { 93 | Player* p = players->at(i); 94 | if (!p->isCombatReady())continue; 95 | if (!p->enemy) continue; 96 | if (!p->visible) continue; 97 | if (p->aimedAt) continue; 98 | if (fabs(p->aimbotDesiredAnglesIncrement.x) > cl->AIMBOT_FOV) continue; 99 | if (fabs(p->aimbotDesiredAnglesIncrement.y) > cl->AIMBOT_FOV) continue; 100 | if (target == nullptr || p->aimbotScore > target->aimbotScore) { 101 | target = p; 102 | target->aimbotLocked = true; 103 | } 104 | } 105 | } 106 | 107 | void releaseTarget() { 108 | if (target != nullptr && target->isValid()) 109 | target->aimbotLocked = false; 110 | target = nullptr; 111 | } 112 | 113 | void resetLockFlag() { 114 | for (int i = 0;i < players->size();i++) { 115 | Player* p = players->at(i); 116 | if (!p->isCombatReady()) continue; 117 | p->aimbotLocked = false; 118 | } 119 | if (target != nullptr) 120 | target->aimbotLocked = true; 121 | } 122 | 123 | int roundHalfEven(float x) { 124 | return (x >= 0.0) 125 | ? static_cast(std::round(x)) 126 | : static_cast(std::round(-x)) * -1; 127 | } 128 | 129 | float atLeast_1_AwayFromZero(float num) { 130 | if (num > 0) return std::max(num, 1.0f); 131 | return std::min(num, -1.0f); 132 | } 133 | }; 134 | -------------------------------------------------------------------------------- /Color.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct Color { 3 | float red; 4 | float green; 5 | float blue; 6 | 7 | bool operator==(const Color& other) const { 8 | return (red == other.red) && (green == other.green) && (blue == other.blue); 9 | } 10 | 11 | bool operator!=(const Color& other) const { 12 | return !(*this == other); 13 | } 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /ConfigLoader.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct ConfigLoader { 3 | const std::string FILE_NAME = "grinder.ini"; 4 | std::vector* lines = new std::vector; 5 | long m_lastTimeFileEdited = 0; 6 | 7 | ConfigLoader() { 8 | reloadFile(); 9 | } 10 | 11 | //features 12 | bool FEATURE_AIMBOT_ON = true; 13 | bool FEATURE_SENSE_ON = true; 14 | bool FEATURE_TRIGGERBOT_ON = true; 15 | bool FEATURE_NORECOIL_ON = true; 16 | 17 | //norecoil 18 | int NORECOIL_PITCH_REDUCTION = 15; 19 | int NORECOIL_YAW_REDUCTION = 17; 20 | 21 | //aimbot 22 | bool AIMBOT_ACTIVATED_BY_ATTACK = true; 23 | bool AIMBOT_ACTIVATED_BY_ADS = false; 24 | std::string AIMBOT_ACTIVATED_BY_BUTTON = "XK_Shift_L"; 25 | int AIMBOT_SMOOTH = 20; 26 | int AIMBOT_SMOOTH_EXTRA_BY_DISTANCE = 1000; 27 | float AIMBOT_FOV = 5.0000; 28 | float AIMBOT_DEADZONE = 0.0100; 29 | int AIMBOT_MAX_DISTANCE = 100; 30 | int AIMBOT_MIN_DISTANCE = 1; 31 | 32 | //sense 33 | bool SENSE_ENEMY_COLOR_SHIELD_BASED = true; 34 | 35 | float SENSE_ENEMY_VISIBLE_COLOR_RED = 0; 36 | float SENSE_ENEMY_VISIBLE_COLOR_GREEN = 10; 37 | float SENSE_ENEMY_VISIBLE_COLOR_BLUE = 0; 38 | int SENSE_ENEMY_VISIBLE_BODY_STYLE = 112; 39 | int SENSE_ENEMY_VISIBLE_BORDER_STYLE = 108; 40 | int SENSE_ENEMY_VISIBLE_BORDER_WIDTH = 60; 41 | 42 | float SENSE_ENEMY_INVISIBLE_COLOR_RED = 10; 43 | float SENSE_ENEMY_INVISIBLE_COLOR_GREEN = 0; 44 | float SENSE_ENEMY_INVISIBLE_COLOR_BLUE = 0; 45 | int SENSE_ENEMY_INVISIBLE_BODY_STYLE = 112; 46 | int SENSE_ENEMY_INVISIBLE_BORDER_STYLE = 108; 47 | int SENSE_ENEMY_INVISIBLE_BORDER_WIDTH = 45; 48 | 49 | float SENSE_ENEMY_LOCKEDON_COLOR_RED = 0; 50 | float SENSE_ENEMY_LOCKEDON_COLOR_GREEN = 0; 51 | float SENSE_ENEMY_LOCKEDON_COLOR_BLUE = 10; 52 | int SENSE_ENEMY_LOCKEDON_BODY_STYLE = 112; 53 | int SENSE_ENEMY_LOCKEDON_BORDER_STYLE = 108; 54 | int SENSE_ENEMY_LOCKEDON_BORDER_WIDTH = 120; 55 | 56 | void loadVariables(std::string key, std::string val) { 57 | //features 58 | FEATURE_AIMBOT_ON = (key.compare("FEATURE_AIMBOT_ON") != 0) ? FEATURE_AIMBOT_ON : toBool(val); 59 | FEATURE_SENSE_ON = (key.compare("FEATURE_SENSE_ON") != 0) ? FEATURE_SENSE_ON : toBool(val); 60 | FEATURE_TRIGGERBOT_ON = (key.compare("FEATURE_TRIGGERBOT_ON") != 0) ? FEATURE_TRIGGERBOT_ON : toBool(val); 61 | FEATURE_NORECOIL_ON = (key.compare("FEATURE_NORECOIL_ON") != 0) ? FEATURE_NORECOIL_ON : toBool(val); 62 | 63 | //norecoil 64 | NORECOIL_PITCH_REDUCTION = (key.compare("NORECOIL_PITCH_REDUCTION") != 0) ? NORECOIL_PITCH_REDUCTION : stoi(val); 65 | NORECOIL_YAW_REDUCTION = (key.compare("NORECOIL_YAW_REDUCTION") != 0) ? NORECOIL_YAW_REDUCTION : stoi(val); 66 | 67 | //aimbot 68 | AIMBOT_ACTIVATED_BY_ATTACK = (key.compare("AIMBOT_ACTIVATED_BY_ATTACK") != 0) ? AIMBOT_ACTIVATED_BY_ATTACK : toBool(val); 69 | AIMBOT_ACTIVATED_BY_ADS = (key.compare("AIMBOT_ACTIVATED_BY_ADS") != 0) ? AIMBOT_ACTIVATED_BY_ADS : toBool(val); 70 | AIMBOT_ACTIVATED_BY_BUTTON = (key.compare("AIMBOT_ACTIVATED_BY_BUTTON") != 0) ? AIMBOT_ACTIVATED_BY_BUTTON : trimConstructive(val); 71 | AIMBOT_SMOOTH = (key.compare("AIMBOT_SMOOTH") != 0) ? AIMBOT_SMOOTH : stoi(val); 72 | AIMBOT_SMOOTH_EXTRA_BY_DISTANCE = (key.compare("AIMBOT_SMOOTH_EXTRA_BY_DISTANCE") != 0) ? AIMBOT_SMOOTH_EXTRA_BY_DISTANCE : stoi(val); 73 | AIMBOT_FOV = (key.compare("AIMBOT_FOV") != 0) ? AIMBOT_FOV : stod(val); 74 | AIMBOT_DEADZONE = (key.compare("AIMBOT_DEADZONE") != 0) ? AIMBOT_DEADZONE : stod(val); 75 | 76 | //sense 77 | SENSE_ENEMY_COLOR_SHIELD_BASED = (key.compare("SENSE_ENEMY_COLOR_SHIELD_BASED") != 0) ? SENSE_ENEMY_COLOR_SHIELD_BASED : toBool(val); 78 | 79 | SENSE_ENEMY_VISIBLE_COLOR_RED = (key.compare("SENSE_ENEMY_VISIBLE_COLOR_RED") != 0) ? SENSE_ENEMY_VISIBLE_COLOR_RED : stoi(val); 80 | SENSE_ENEMY_VISIBLE_COLOR_GREEN = (key.compare("SENSE_ENEMY_VISIBLE_COLOR_GREEN") != 0) ? SENSE_ENEMY_VISIBLE_COLOR_GREEN : stoi(val); 81 | SENSE_ENEMY_VISIBLE_COLOR_BLUE = (key.compare("SENSE_ENEMY_VISIBLE_COLOR_BLUE") != 0) ? SENSE_ENEMY_VISIBLE_COLOR_BLUE : stoi(val); 82 | SENSE_ENEMY_VISIBLE_BODY_STYLE = (key.compare("SENSE_ENEMY_VISIBLE_BODY_STYLE") != 0) ? SENSE_ENEMY_VISIBLE_BODY_STYLE : stoi(val); 83 | SENSE_ENEMY_VISIBLE_BORDER_STYLE = (key.compare("SENSE_ENEMY_VISIBLE_BORDER_STYLE") != 0) ? SENSE_ENEMY_VISIBLE_BORDER_STYLE : stoi(val); 84 | SENSE_ENEMY_VISIBLE_BORDER_WIDTH = (key.compare("SENSE_ENEMY_VISIBLE_BORDER_WIDTH") != 0) ? SENSE_ENEMY_VISIBLE_BORDER_WIDTH : stoi(val); 85 | 86 | SENSE_ENEMY_INVISIBLE_COLOR_RED = (key.compare("SENSE_ENEMY_INVISIBLE_COLOR_RED") != 0) ? SENSE_ENEMY_INVISIBLE_COLOR_RED : stoi(val); 87 | SENSE_ENEMY_INVISIBLE_COLOR_GREEN = (key.compare("SENSE_ENEMY_INVISIBLE_COLOR_GREEN") != 0) ? SENSE_ENEMY_INVISIBLE_COLOR_GREEN : stoi(val); 88 | SENSE_ENEMY_INVISIBLE_COLOR_BLUE = (key.compare("SENSE_ENEMY_INVISIBLE_COLOR_BLUE") != 0) ? SENSE_ENEMY_INVISIBLE_COLOR_BLUE : stoi(val); 89 | SENSE_ENEMY_INVISIBLE_BODY_STYLE = (key.compare("SENSE_ENEMY_INVISIBLE_BODY_STYLE") != 0) ? SENSE_ENEMY_INVISIBLE_BODY_STYLE : stoi(val); 90 | SENSE_ENEMY_INVISIBLE_BORDER_STYLE = (key.compare("SENSE_ENEMY_INVISIBLE_BORDER_STYLE") != 0) ? SENSE_ENEMY_INVISIBLE_BORDER_STYLE : stoi(val); 91 | SENSE_ENEMY_INVISIBLE_BORDER_WIDTH = (key.compare("SENSE_ENEMY_INVISIBLE_BORDER_WIDTH") != 0) ? SENSE_ENEMY_INVISIBLE_BORDER_WIDTH : stoi(val); 92 | 93 | SENSE_ENEMY_LOCKEDON_COLOR_RED = (key.compare("SENSE_ENEMY_LOCKEDON_COLOR_RED") != 0) ? SENSE_ENEMY_LOCKEDON_COLOR_RED : stoi(val); 94 | SENSE_ENEMY_LOCKEDON_COLOR_GREEN = (key.compare("SENSE_ENEMY_LOCKEDON_COLOR_GREEN") != 0) ? SENSE_ENEMY_LOCKEDON_COLOR_GREEN : stoi(val); 95 | SENSE_ENEMY_LOCKEDON_COLOR_BLUE = (key.compare("SENSE_ENEMY_LOCKEDON_COLOR_BLUE") != 0) ? SENSE_ENEMY_LOCKEDON_COLOR_BLUE : stoi(val); 96 | SENSE_ENEMY_LOCKEDON_BODY_STYLE = (key.compare("SENSE_ENEMY_LOCKEDON_BODY_STYLE") != 0) ? SENSE_ENEMY_LOCKEDON_BODY_STYLE : stoi(val); 97 | SENSE_ENEMY_LOCKEDON_BORDER_STYLE = (key.compare("SENSE_ENEMY_LOCKEDON_BORDER_STYLE") != 0) ? SENSE_ENEMY_LOCKEDON_BORDER_STYLE : stoi(val); 98 | SENSE_ENEMY_LOCKEDON_BORDER_WIDTH = (key.compare("SENSE_ENEMY_LOCKEDON_BORDER_WIDTH") != 0) ? SENSE_ENEMY_LOCKEDON_BORDER_WIDTH : stoi(val); 99 | } 100 | 101 | void print() { 102 | printf("\n==================== GRINDER SETTINGS LOADED ========================\n"); 103 | 104 | //features 105 | printf("FEATURE_AIMBOT_ON\t\t\t\t\t%s\n", FEATURE_AIMBOT_ON ? "YES" : "NO"); 106 | printf("FEATURE_SENSE_ON\t\t\t\t\t%s\n", FEATURE_SENSE_ON ? "YES" : "NO"); 107 | printf("FEATURE_TRIGGERBOT_ON\t\t\t\t\t%s\n", FEATURE_TRIGGERBOT_ON ? "YES" : "NO"); 108 | printf("FEATURE_NORECOIL_ON\t\t\t\t\t%s\n", FEATURE_NORECOIL_ON ? "YES" : "NO"); 109 | printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 110 | 111 | //norecoil 112 | printf("NORECOIL_PITCH_REDUCTION\t\t\t\t%d\n", NORECOIL_PITCH_REDUCTION); 113 | printf("NORECOIL_YAW_REDUCTION\t\t\t\t\t%d\n", NORECOIL_YAW_REDUCTION); 114 | printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 115 | 116 | //aimbot 117 | printf("AIMBOT_ACTIVATED_BY_ATTACK\t\t\t\t%s\n", AIMBOT_ACTIVATED_BY_ATTACK ? "YES" : "NO"); 118 | printf("AIMBOT_ACTIVATED_BY_ADS\t\t\t\t\t%s\n", AIMBOT_ACTIVATED_BY_ADS ? "YES" : "NO"); 119 | printf("AIMBOT_ACTIVATED_BY_BUTTON\t\t\t\t%s\n", AIMBOT_ACTIVATED_BY_BUTTON.c_str()); 120 | printf("AIMBOT_SMOOTH\t\t\t\t\t\t%.d\n", AIMBOT_SMOOTH); 121 | printf("AIMBOT_SMOOTH_EXTRA_BY_DISTANCE\t\t\t\t%.d\n", AIMBOT_SMOOTH_EXTRA_BY_DISTANCE); 122 | printf("AIMBOT_FOV\t\t\t\t\t\t%.4f\n", AIMBOT_FOV); 123 | printf("AIMBOT_DEADZONE\t\t\t\t\t\t%.4f\n", AIMBOT_DEADZONE); 124 | printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"); 125 | 126 | //sense 127 | printf("SENSE_ENEMY_COLOR_SHIELD_BASED\t\t\t\t%s\n", SENSE_ENEMY_COLOR_SHIELD_BASED ? "YES" : "NO"); 128 | printf("SENSE_ENEMY_VISIBLE_COLOR_RED\t\t\t\t%.0f\n", SENSE_ENEMY_VISIBLE_COLOR_RED); 129 | printf("SENSE_ENEMY_VISIBLE_COLOR_GREEN\t\t\t\t%.0f\n", SENSE_ENEMY_VISIBLE_COLOR_GREEN); 130 | printf("SENSE_ENEMY_VISIBLE_COLOR_BLUE\t\t\t\t%.0f\n", SENSE_ENEMY_VISIBLE_COLOR_BLUE); 131 | printf("SENSE_ENEMY_VISIBLE_BODY_STYLE\t\t\t\t%.d\n", SENSE_ENEMY_VISIBLE_BODY_STYLE); 132 | printf("SENSE_ENEMY_VISIBLE_BORDER_STYLE\t\t\t%.d\n", SENSE_ENEMY_VISIBLE_BORDER_STYLE); 133 | printf("SENSE_ENEMY_VISIBLE_BORDER_WIDTH\t\t\t%.d\n", SENSE_ENEMY_VISIBLE_BORDER_WIDTH); 134 | printf("SENSE_ENEMY_INVISIBLE_COLOR_RED\t\t\t\t%.0f\n", SENSE_ENEMY_INVISIBLE_COLOR_RED); 135 | printf("SENSE_ENEMY_INVISIBLE_COLOR_GREEN\t\t\t%.0f\n", SENSE_ENEMY_INVISIBLE_COLOR_GREEN); 136 | printf("SENSE_ENEMY_INVISIBLE_COLOR_BLUE\t\t\t%.0f\n", SENSE_ENEMY_INVISIBLE_COLOR_BLUE); 137 | printf("SENSE_ENEMY_INVISIBLE_BODY_STYLE\t\t\t%.d\n", SENSE_ENEMY_INVISIBLE_BODY_STYLE); 138 | printf("SENSE_ENEMY_INVISIBLE_BORDER_STYLE\t\t\t%.d\n", SENSE_ENEMY_INVISIBLE_BORDER_STYLE); 139 | printf("SENSE_ENEMY_INVISIBLE_BORDER_WIDTH\t\t\t%.d\n", SENSE_ENEMY_INVISIBLE_BORDER_WIDTH); 140 | printf("SENSE_ENEMY_LOCKEDON_COLOR_RED\t\t\t\t%.0f\n", SENSE_ENEMY_LOCKEDON_COLOR_RED); 141 | printf("SENSE_ENEMY_LOCKEDON_COLOR_GREEN\t\t\t%.0f\n", SENSE_ENEMY_LOCKEDON_COLOR_GREEN); 142 | printf("SENSE_ENEMY_LOCKEDON_COLOR_BLUE\t\t\t\t%.0f\n", SENSE_ENEMY_LOCKEDON_COLOR_BLUE); 143 | printf("SENSE_ENEMY_LOCKEDON_BODY_STYLE\t\t\t\t%.d\n", SENSE_ENEMY_LOCKEDON_BODY_STYLE); 144 | printf("SENSE_ENEMY_LOCKEDON_BORDER_STYLE\t\t\t%.d\n", SENSE_ENEMY_LOCKEDON_BORDER_STYLE); 145 | printf("SENSE_ENEMY_LOCKEDON_BORDER_WIDTH\t\t\t%.d\n", SENSE_ENEMY_LOCKEDON_BORDER_WIDTH); 146 | 147 | printf("=====================================================================\n\n"); 148 | } 149 | 150 | void reloadFile() { 151 | if (loadFileIntoVector()) { 152 | parseLines(); 153 | print(); 154 | } 155 | } 156 | 157 | void parseLines() { 158 | for (int i = 0; i < lines->size(); i++) { 159 | std::vector lineParts = split(lines->at(i)); 160 | // line key 161 | std::string key(lineParts.at(0)); 162 | trim(key); 163 | if (key.empty()) throw "Cannot parse the config. Bad key"; 164 | // line value 165 | std::string value(lineParts.at(1)); 166 | trim(value); 167 | if (value.empty()) throw "Cannot parse the config. Bad value"; 168 | loadVariables(key, value); 169 | } 170 | } 171 | 172 | bool loadFileIntoVector() { 173 | struct stat result; 174 | if (stat(FILE_NAME.c_str(), &result) == 0) { 175 | long modTime = result.st_mtime; 176 | bool fileNeedsReload = modTime > m_lastTimeFileEdited; 177 | m_lastTimeFileEdited = modTime; 178 | if (!fileNeedsReload) return false; 179 | } 180 | lines->clear(); 181 | std::string str; 182 | std::ifstream myFile(FILE_NAME); 183 | while (getline(myFile, str)) { 184 | trim(str); 185 | if (str.empty()) continue; 186 | if (str.rfind("#", 0) == 0) continue; 187 | lines->push_back(str); 188 | } 189 | myFile.close(); 190 | return true; 191 | } 192 | 193 | bool toBool(std::string str) { 194 | if (toLowerCase(str) == "y") return true; 195 | if (toLowerCase(str) == "n") return false; 196 | if (toLowerCase(str) == "yes") return true; 197 | if (toLowerCase(str) == "no") return false; 198 | if (toLowerCase(str) == "1") return true; 199 | if (toLowerCase(str) == "0") return false; 200 | throw std::invalid_argument("Cannot parse string to boolean: " + str); 201 | } 202 | 203 | void trim(std::string& s) { 204 | ltrim(s); 205 | rtrim(s); 206 | } 207 | 208 | std::string trimConstructive(std::string& s) { 209 | ltrim(s); 210 | rtrim(s); 211 | return s; 212 | } 213 | 214 | void ltrim(std::string& s) { 215 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) 216 | { return !std::isspace(ch); })); 217 | } 218 | 219 | void rtrim(std::string& s) { 220 | s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) 221 | { return !std::isspace(ch); }) 222 | .base(), 223 | s.end()); 224 | } 225 | 226 | std::vector split(std::string s) { 227 | std::stringstream ss(s); 228 | std::istream_iterator begin(ss); 229 | std::istream_iterator end; 230 | std::vector tokens(begin, end); 231 | return tokens; 232 | } 233 | 234 | std::string toLowerCase(const std::string& input) { 235 | std::string result = input; 236 | std::transform(result.begin(), result.end(), result.begin(), ::tolower); 237 | return result; 238 | } 239 | }; -------------------------------------------------------------------------------- /FloatVector2D.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct FloatVector2D { 3 | float x, y; 4 | 5 | FloatVector2D() : x(0), y(0) {} 6 | 7 | FloatVector2D(float x_val, float y_val) : x(x_val), y(y_val) {} 8 | 9 | FloatVector2D subtract(const FloatVector2D& other) const { 10 | return FloatVector2D(x - other.x, y - other.y); 11 | } 12 | 13 | FloatVector2D add(const FloatVector2D& other) const { 14 | return FloatVector2D(x + other.x, y + other.y); 15 | } 16 | 17 | FloatVector2D divide(const FloatVector2D& other) const { 18 | return FloatVector2D(x / other.x, y / other.y); 19 | } 20 | 21 | FloatVector2D divide(float scalar) const { 22 | return FloatVector2D(x / scalar, y / scalar); 23 | } 24 | 25 | float dotProduct(const FloatVector2D& other) const { 26 | return x * other.x + y * other.y; 27 | } 28 | 29 | float magnitude() const { 30 | return std::sqrt(x * x + y * y); 31 | } 32 | 33 | float distance(const FloatVector2D& other) const { 34 | FloatVector2D diff = subtract(other); 35 | return diff.magnitude(); 36 | } 37 | 38 | FloatVector2D multiply(float scalar) const { 39 | return FloatVector2D(x * scalar, y * scalar); 40 | } 41 | 42 | FloatVector2D normalized() const { 43 | FloatVector2D result; 44 | float length = std::sqrt(x * x + y * y); 45 | if (length != 0) { 46 | result.x = x / length; 47 | result.y = y / length; 48 | } 49 | return result; 50 | } 51 | 52 | FloatVector2D multipliedByScalar(float scalar) const { 53 | FloatVector2D result; 54 | result.x = x * scalar; 55 | result.y = y * scalar; 56 | return result; 57 | } 58 | 59 | FloatVector2D clamp() const { 60 | //pitch doesnt have a full rotation so just set it to max value if its more than that 61 | float clampedX = x; 62 | if (clampedX < -89) clampedX = -89; 63 | if (clampedX > 89) clampedX = 89; 64 | //yaw has a full rotation so we might want to move it to the oposite side from negative to positive or vice versa 65 | float clampedY = y; 66 | if (clampedY < -180) clampedY += 360; 67 | if (clampedY > 180) clampedY -= 360; 68 | //create the vector 69 | if (clampedX > 89 || clampedX < -89) throw std::invalid_argument("SHIT CLAMPING OF PITCH. CHECK YOUR CODE"); 70 | if (clampedY > 180 || clampedY < -180) throw std::invalid_argument("SHIT CLAMPING OF YAW. CHECK YOUR CODE"); 71 | return FloatVector2D(clampedX, clampedY); 72 | } 73 | 74 | bool isZeroVector() { 75 | return x == 0 && y == 0; 76 | } 77 | 78 | std::string toString() const { 79 | return "(" + std::to_string(x) + ", " + std::to_string(y) + ")"; 80 | } 81 | 82 | void print() { 83 | std::cout << toString() << "\n"; 84 | } 85 | 86 | bool operator==(const FloatVector2D& other) const { 87 | float epsilon = 1e-5; 88 | return (std::abs(x - other.x) < epsilon) 89 | && (std::abs(y - other.y) < epsilon); 90 | } 91 | 92 | bool operator!=(const FloatVector2D& other) const { 93 | return !(*this == other); 94 | } 95 | }; 96 | -------------------------------------------------------------------------------- /FloatVector3D.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct FloatVector3D { 3 | float x, y, z; 4 | 5 | FloatVector3D() : x(0), y(0), z(0) {} 6 | 7 | FloatVector3D(float x_val, float y_val, float z_val) : x(x_val), y(y_val), z(z_val) {} 8 | 9 | FloatVector3D subtract(const FloatVector3D& other) const { 10 | return FloatVector3D(x - other.x, y - other.y, z - other.z); 11 | } 12 | 13 | FloatVector3D add(const FloatVector3D& other) const { 14 | return FloatVector3D(x + other.x, y + other.y, z + other.z); 15 | } 16 | 17 | float dotProduct(const FloatVector3D& other) const { 18 | return x * other.x + y * other.y + z * other.z; 19 | } 20 | 21 | float magnitude() const { 22 | return std::sqrt(x * x + y * y + z * z); 23 | } 24 | 25 | float distance(const FloatVector3D& other) const { 26 | FloatVector3D diff = subtract(other); 27 | return diff.magnitude(); 28 | } 29 | 30 | bool isZeroVector() { 31 | return x == 0 && y == 0 && z == 0; 32 | } 33 | 34 | FloatVector3D normalize() const { 35 | float mag = magnitude(); 36 | if (mag != 0) 37 | return FloatVector3D(x / mag, y / mag, z / mag); 38 | return FloatVector3D(); 39 | } 40 | 41 | FloatVector3D multiply(float scalar) const { 42 | return FloatVector3D(x * scalar, y * scalar, z * scalar); 43 | } 44 | 45 | 46 | std::string toString() const { 47 | return "(" + std::to_string(x) + ", " + std::to_string(y) + ", " + std::to_string(z) + ")"; 48 | } 49 | 50 | void print() { 51 | std::cout << toString() << "\n"; 52 | } 53 | 54 | FloatVector2D to2D() const { 55 | return FloatVector2D(x, y); 56 | } 57 | 58 | bool operator==(const FloatVector3D& other) const { 59 | float epsilon = 1e-5; 60 | return (std::abs(x - other.x) < epsilon) 61 | && (std::abs(y - other.y) < epsilon) 62 | && (std::abs(z - other.z) < epsilon); 63 | } 64 | 65 | bool operator!=(const FloatVector3D& other) const { 66 | return !(*this == other); 67 | } 68 | }; -------------------------------------------------------------------------------- /Highlight.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct Highlight { 3 | std::byte bodyStyle; 4 | std::byte borderStyle; 5 | std::byte borderWidth; 6 | std::byte transparency; 7 | float red; 8 | float green; 9 | float blue; 10 | 11 | Highlight() {} 12 | 13 | Highlight(int bodyStyle_val, int borderStyle_val, int borderWidth_val, int transparency_val) : 14 | bodyStyle(static_cast(bodyStyle_val)), 15 | borderStyle(static_cast(borderStyle_val)), 16 | borderWidth(static_cast(borderWidth_val)), 17 | transparency(static_cast(transparency_val)) {} 18 | 19 | 20 | Highlight(std::byte bodyStyle_val, std::byte borderStyle_val, std::byte borderWidth_val, std::byte transparency_val) : 21 | bodyStyle(bodyStyle_val), 22 | borderStyle(borderStyle_val), 23 | borderWidth(borderWidth_val), 24 | transparency(transparency_val) {} 25 | 26 | bool isZeroVector() const { 27 | return bodyStyle == std::byte(0) 28 | && borderStyle == std::byte(0) 29 | && borderWidth == std::byte(0) 30 | && borderWidth == std::byte(0); 31 | } 32 | 33 | void print() const { 34 | std::cout 35 | << "bodyStyle:" << static_cast(bodyStyle) 36 | << " borderStyle:" << static_cast(borderStyle) 37 | << " borderWidth:" << static_cast(borderWidth) 38 | << " transparency:" << static_cast(transparency) 39 | << "\n"; 40 | } 41 | 42 | std::string toString() const { 43 | return "bodyStyle:" + std::to_string(static_cast(bodyStyle)) + 44 | " borderStyle:" + std::to_string(static_cast(borderStyle)) + 45 | " borderWidth:" + std::to_string(static_cast(borderWidth)) + 46 | " transparency:" + std::to_string(static_cast(transparency)) + 47 | " red:" + std::to_string(red) + 48 | " green:" + std::to_string(green) + 49 | " blue:" + std::to_string(blue); 50 | } 51 | 52 | bool operator==(const Highlight& other) const { 53 | return bodyStyle == other.bodyStyle 54 | && borderStyle == other.borderStyle 55 | && borderWidth == other.borderWidth 56 | && transparency == other.transparency; 57 | } 58 | 59 | bool operator!=(const Highlight& other) const { 60 | return !(*this == other); 61 | } 62 | }; 63 | -------------------------------------------------------------------------------- /HighlightList.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct HighlightList { 3 | long highlightMemorySize = 0x34; 4 | long highlighListBase; 5 | const int invisiblePlayerHighlightId = 8; 6 | Highlight invisiblePlayersHighlight; 7 | const int visiblePlayerHighlightId = 9; 8 | Highlight visiblePlayersHighlight; 9 | 10 | void readFromMemory() { 11 | highlighListBase = mem::Read(OFF_REGION + OFF_GLOW_HIGHLIGHTS, "HighlightList Base"); 12 | // printf("HighlightList base: %s\n", mem::convertPointerToHexString(highlighListBase).c_str()); 13 | 14 | //modify the highlight for the invisible players 15 | invisiblePlayersHighlight = mem::Read(highlightBase(invisiblePlayerHighlightId), "HighlightElement functionBits - invisible players"); 16 | // printf("HIGHLIGHT[ininvisiblePlayersHighlightvisible] %s \n", highlight.toString().c_str()); 17 | 18 | //modify highlight for visible players 19 | visiblePlayersHighlight = mem::Read(highlightBase(visiblePlayerHighlightId), "HighlightElement functionBits - visible players"); 20 | // printf("HIGHLIGHT[visiblePlayersHighlight] %s \n", highlight.toString().c_str()); 21 | } 22 | 23 | void updateHighlights() { 24 | invisiblePlayersHighlight.bodyStyle = static_cast(118); 25 | invisiblePlayersHighlight.borderWidth = static_cast(45); 26 | invisiblePlayersHighlight.borderStyle = static_cast(6); 27 | invisiblePlayersHighlight.transparency = static_cast(64); 28 | invisiblePlayersHighlight.blue = 0; 29 | invisiblePlayersHighlight.red = 1; 30 | invisiblePlayersHighlight.green = 0; 31 | mem::Write(highlightBase(invisiblePlayerHighlightId), invisiblePlayersHighlight); 32 | 33 | visiblePlayersHighlight.blue = 0; 34 | visiblePlayersHighlight.red = 0; 35 | visiblePlayersHighlight.green = 1; 36 | mem::Write(highlightBase(visiblePlayerHighlightId), visiblePlayersHighlight); 37 | } 38 | 39 | bool isValid() { 40 | return mem::Valid(highlighListBase); 41 | } 42 | 43 | long highlightBase(int highlightIndex) { 44 | return highlighListBase + (highlightIndex * highlightMemorySize); 45 | } 46 | 47 | 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /Level.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct Level { 3 | std::string name; 4 | bool playable; 5 | bool trainingArea; 6 | 7 | void readFromMemory() { 8 | name = mem::ReadString(OFF_REGION + OFF_LEVEL, 1024, "Level name"); 9 | playable = !name.empty() && name != "mp_lobby"; 10 | trainingArea = name == "mp_rr_canyonlands_staging_mu1"; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /LocalPlayer.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct LocalPlayer { 3 | long base; 4 | bool dead; 5 | bool knocked; 6 | int teamNumber; 7 | bool inAttack; 8 | bool inZoom; 9 | long highlightSettingsPtr; 10 | FloatVector3D localOrigin; 11 | FloatVector2D viewAngles; 12 | FloatVector2D punchAngles; 13 | FloatVector2D punchAnglesPrev; 14 | FloatVector2D punchAnglesDiff; 15 | int weaponIndex; 16 | bool weaponDiscarded; 17 | 18 | void readFromMemory() { 19 | base = mem::Read(OFF_REGION + OFF_LOCAL_PLAYER, "LocalPlayer base"); 20 | if (!mem::Valid(base))return; 21 | dead = mem::Read(base + OFF_LIFE_STATE, "LocalPlayer base") > 0; 22 | knocked = mem::Read(base + OFF_BLEEDOUT_STATE, "LocalPlayer base") > 0; 23 | inZoom = mem::Read(base + OFF_ZOOMING, "LocalPlayer inZoom") > 0; 24 | teamNumber = mem::Read(base + OFF_TEAM_NUMBER, "LocalPlayer teamNumber"); 25 | inAttack = mem::Read(OFF_REGION + OFF_IN_ATTACK, "LocalPlayer inAttack") > 0; 26 | highlightSettingsPtr = mem::Read(OFF_REGION + OFF_GLOW_HIGHLIGHTS, "LocalPlayer HiglightsSettingPtr"); 27 | localOrigin = mem::Read(base + OFF_LOCAL_ORIGIN, "LocalPlayer localOrigin"); 28 | viewAngles = mem::Read(base + OFF_VIEW_ANGLES, "LocalPlayer viewAngles"); 29 | punchAngles = mem::Read(base + OFF_PUNCH_ANGLES, "LocalPlayer punchAngles"); 30 | punchAnglesDiff = punchAnglesPrev.subtract(punchAngles); 31 | punchAnglesPrev = punchAngles; 32 | if (!dead && !knocked) { 33 | long weaponHandle = mem::Read(base + OFF_WEAPON_HANDLE, "LocalPlayer weaponHandle"); 34 | long weaponHandleMasked = weaponHandle & 0xffff; 35 | long weaponEntity = mem::Read(OFF_REGION + OFF_ENTITY_LIST + (weaponHandleMasked << 5), "LocalPlayer weaponEntity"); 36 | weaponIndex = mem::Read(weaponEntity + OFF_WEAPON_INDEX, "LocalPlayer weaponIndex"); 37 | weaponDiscarded = mem::Read(weaponEntity + OFF_WEAPON_DISCARDED, "LocalPlayer weaponDiscarded") == 1; 38 | } 39 | } 40 | 41 | bool isValid() { 42 | return mem::Valid(base); 43 | } 44 | 45 | bool isCombatReady() { 46 | if (base == 0) return false; 47 | if (dead) return false; 48 | if (knocked) return false; 49 | return true; 50 | } 51 | 52 | void print() const { 53 | printf("________________________________________________________________________\n"); 54 | printf("LocalPlayer____Base: %s\n", util::longToHexString(base).c_str()); 55 | printf("LocalPlayer____Dead: %s\n", dead ? "true" : "false"); 56 | printf("LocalPlayer____Knocked: %s\n", knocked ? "true" : "false"); 57 | printf("LocalPlayer____Team Number: %d\n", teamNumber); 58 | printf("LocalPlayer____In Attack: %s\n", inAttack ? "true" : "false"); 59 | printf("LocalPlayer____In Zoom: %s\n", inZoom ? "true" : "false"); 60 | printf("LocalPlayer____Local Origin: %s\n", localOrigin.toString().c_str()); 61 | printf("LocalPlayer____View Angles: %s\n", viewAngles.toString().c_str()); 62 | printf("LocalPlayer____Punch Angles: %s\n", punchAngles.toString().c_str()); 63 | printf("LocalPlayer____Punch Angles Prev: %s\n", punchAnglesPrev.toString().c_str()); 64 | printf("LocalPlayer____Punch Angles Diff: %s\n", punchAnglesDiff.toString().c_str()); 65 | printf("LocalPlayer____Weapon Index: %d\n", weaponIndex); 66 | printf("LocalPlayer____Weapon Discarded: %s\n", weaponDiscarded ? "true" : "false"); 67 | printf("________________________________________________________________________\n"); 68 | } 69 | }; -------------------------------------------------------------------------------- /Main.cpp: -------------------------------------------------------------------------------- 1 | #include "includes.hpp" 2 | 3 | int main() { 4 | //load config 5 | ConfigLoader* cl = new ConfigLoader(); 6 | 7 | //basic checks 8 | if (getuid()) { std::cout << "RUN AS SUDO!\n"; return -1; } 9 | if (mem::GetPID() == 0) { std::cout << "OPEN THE GAME FIRST!\n"; return -1; } 10 | 11 | //create basic objects 12 | XDisplay* display = new XDisplay(); 13 | Level* level = new Level(); 14 | LocalPlayer* localPlayer = new LocalPlayer(); 15 | HighlightList* highlightList = new HighlightList(); 16 | std::vector* humanPlayers = new std::vector; 17 | std::vector* dummyPlayers = new std::vector; 18 | std::vector* players = new std::vector; 19 | 20 | //fill in slots for players and dummies 21 | for (int i = 0; i < 70; i++) humanPlayers->push_back(new Player(i, localPlayer)); 22 | for (int i = 0; i < 15000; i++) dummyPlayers->push_back(new Player(i, localPlayer)); 23 | 24 | //construct features 25 | NoRecoil* noRecoil = new NoRecoil(cl, display, level, localPlayer); 26 | AimBot* aimBot = new AimBot(cl, display, level, localPlayer, players); 27 | TriggerBot* triggerBot = new TriggerBot(cl, display, level, localPlayer, players); 28 | Sense* sense = new Sense(cl, display, level, localPlayer, players); 29 | 30 | //begin main loop 31 | for (int counter = 0; ; counter = ((counter >= 1000) ? 0 : counter + 1)) { 32 | try { 33 | //record time so we know how long a single iteration takes 34 | long long startTime = util::currentEpochMillis(); 35 | 36 | // will attempt to reload config if there have been any updates to it 37 | if (counter % 100 == 0) cl->reloadFile(); 38 | 39 | //read level and make sure it is playable 40 | level->readFromMemory(); 41 | if (!level->playable) { 42 | printf("Current level is \"%s\" which is unplayable. Sleeping 10 seconds... \n", level->name.c_str()); 43 | std::this_thread::sleep_for(std::chrono::milliseconds(10000)); 44 | continue; 45 | } 46 | 47 | //read highlight list 48 | highlightList->readFromMemory(); 49 | if (!highlightList->isValid()) throw std::invalid_argument("HighlightList invalid!"); 50 | 51 | // //read localPlayer and make sure he is valid 52 | localPlayer->readFromMemory(); 53 | if (!localPlayer->isValid()) throw std::invalid_argument("LocalPlayer invalid!"); 54 | 55 | //read players list 56 | players->clear(); 57 | if (level->trainingArea) 58 | for (int i = 0; i < dummyPlayers->size(); i++) { 59 | Player* p = dummyPlayers->at(i); 60 | p->readFromMemory(); 61 | if (p->isValid()) players->push_back(p); 62 | } 63 | else 64 | for (int i = 0; i < humanPlayers->size(); i++) { 65 | Player* p = humanPlayers->at(i); 66 | p->readFromMemory(); 67 | if (p->isValid()) players->push_back(p); 68 | } 69 | 70 | //run features 71 | noRecoil->noRecoil(counter); 72 | triggerBot->shootAtEnemy(); 73 | aimBot->aimAssist(counter); 74 | highlightList->updateHighlights(); 75 | sense->update(); 76 | 77 | //check how fast we completed all the processing and if we still have time left to sleep 78 | int processingTime = static_cast(util::currentEpochMillis() - startTime); 79 | int goalSleepTime = 6; // 16.67ms=60HZ | 6.97ms=144HZ 80 | int timeLeftToSleep = std::max(0, goalSleepTime - processingTime); 81 | std::this_thread::sleep_for(std::chrono::milliseconds(timeLeftToSleep)); 82 | 83 | //print loop info every now and then 84 | if (counter == 0) { 85 | printf("| LOOP[%04d] OK | Processing time: %02dms | Time left to sleep: %02dms | Level: %s |\n", 86 | counter, processingTime, timeLeftToSleep, level->name.c_str()); 87 | 88 | // DEBUG - print player structs if in the training area 89 | // if (level->trainingArea) { 90 | // if (localPlayer->isValid()) localPlayer->print(); 91 | // for (int i = 0; i < players->size(); i++) { 92 | // Player* p = players->at(i); 93 | // if (p->isValid()) p->print(); 94 | // } 95 | // } 96 | } 97 | 98 | } 99 | catch (std::invalid_argument& e) { 100 | printf("!!!ERROR!!! %s SLEEPING 10 SECONDS AND TRYING AGAIN! \n", e.what()); 101 | std::this_thread::sleep_for(std::chrono::seconds(10)); 102 | } 103 | catch (...) { 104 | printf("!!!UNKNOWN ERROR!!! SLEEPING 10 SECONDS AND TRYING AGAIN! \n"); 105 | std::this_thread::sleep_for(std::chrono::seconds(10)); 106 | } 107 | } 108 | 109 | 110 | 111 | } 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Default target 2 | all: rebuild; 3 | 4 | # Clean up object files and the executable 5 | clean: 6 | rm -f a.out 7 | 8 | # Compilation and linking 9 | a.out: $(SRCS) 10 | g++ Main.cpp -o a.out -lX11 -lXtst -lXcomposite 11 | 12 | 13 | # clean & build 14 | rebuild: 15 | @$(MAKE) clean 16 | @$(MAKE) a.out 17 | echo "SUCCESS!" 18 | 19 | -------------------------------------------------------------------------------- /Memory.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace mem { 3 | pid_t m_pid = 0; 4 | 5 | pid_t GetPID() { 6 | if (m_pid > 0) return m_pid; 7 | char buf[512]; 8 | FILE* cmd_pipe = popen("pidof -s r5apex.exe", "r"); 9 | fgets(buf, 512, cmd_pipe); 10 | pid_t pid = strtoul(buf, NULL, 10); 11 | pclose(cmd_pipe); 12 | m_pid = pid; 13 | return pid; 14 | } 15 | 16 | bool Valid(long ptr) { 17 | return ptr > 0x00000000 && ptr < 0xffffffff; 18 | } 19 | 20 | std::string convertPointerToHexString(long pointer) { 21 | std::stringstream stream; 22 | stream << "0x" << std::hex << pointer; 23 | std::string result(stream.str()); 24 | return result; 25 | } 26 | 27 | bool Read(long address, void* pBuff, size_t size) { 28 | if (size == 0) 29 | return false; 30 | void* pAddress = (void*)address; 31 | pid_t pid = GetPID(); 32 | struct iovec iovLocalAddressSpace[1]{ 0 }; 33 | struct iovec iovRemoteAddressSpace[1]{ 0 }; 34 | iovLocalAddressSpace[0].iov_base = pBuff; // Store data in this buffer 35 | iovLocalAddressSpace[0].iov_len = size; // which has this size. 36 | iovRemoteAddressSpace[0].iov_base = pAddress; // The data comes from here 37 | iovRemoteAddressSpace[0].iov_len = size; // and has this size. 38 | ssize_t sSize = process_vm_readv( 39 | pid, // Remote process id 40 | iovLocalAddressSpace, // Local iovec array 41 | 1, // Size of the local iovec array 42 | iovRemoteAddressSpace, // Remote iovec array 43 | 1, // Size of the remote iovec array 44 | 0); // Flags, unused 45 | if (sSize == (ssize_t)size) 46 | return true; 47 | else if (sSize == 0) 48 | return false; 49 | return false; 50 | } 51 | 52 | bool Write(long address, void* pBuff, size_t size) { 53 | if (size == 0) 54 | return false; 55 | void* pAddress = (void*)address; 56 | pid_t pid = GetPID(); 57 | struct iovec iovLocalAddressSpace[1]{ 0 }; 58 | struct iovec iovRemoteAddressSpace[1]{ 0 }; 59 | iovLocalAddressSpace[0].iov_base = pBuff; // Store data in this buffer 60 | iovLocalAddressSpace[0].iov_len = size; // which has this size. 61 | iovRemoteAddressSpace[0].iov_base = pAddress; // The data will be writted here 62 | iovRemoteAddressSpace[0].iov_len = size; // and has this size. 63 | ssize_t sSize = process_vm_writev( 64 | pid, // Remote process id 65 | iovLocalAddressSpace, // Local iovec array 66 | 1, // Size of the local iovec array 67 | iovRemoteAddressSpace, // Remote iovec array 68 | 1, // Size of the remote iovec array 69 | 0); // Flags, unused 70 | if (sSize == (ssize_t)size) 71 | return true; 72 | else if (sSize == 0) 73 | return false; 74 | return false; 75 | } 76 | 77 | template 78 | T Read(long address, std::string whatAreYouReading) { 79 | T buffer; 80 | bool success = Read(address, &buffer, sizeof(T)); 81 | if (!success) { 82 | m_pid = 0; 83 | throw std::invalid_argument("Failed to read memory [" + whatAreYouReading + "] at address : " + convertPointerToHexString(address)); 84 | } 85 | return buffer; 86 | } 87 | 88 | template 89 | void Write(long address, T value) { 90 | bool success = Write(address, &value, sizeof(T)); 91 | if (!success) { 92 | m_pid = 0; 93 | throw std::invalid_argument( 94 | "Failed to write memory " + std::to_string(sizeof(T)) + " at: " + convertPointerToHexString(address)); 95 | } 96 | } 97 | 98 | std::string ReadString(long address, int size, std::string whatAreYouReading) { 99 | char buffer[size] = { 0 }; 100 | bool success = Read(address, &buffer, size); 101 | if (!success) { 102 | m_pid = 0; 103 | throw std::invalid_argument("Failed to read memory string [" + whatAreYouReading + "] at address : " + convertPointerToHexString(address)); 104 | } 105 | return std::string(buffer); 106 | } 107 | 108 | 109 | } -------------------------------------------------------------------------------- /NoRecoil.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct NoRecoil { 3 | ConfigLoader* cl; 4 | XDisplay* display; 5 | Level* level; 6 | LocalPlayer* localPlayer; 7 | 8 | FloatVector2D previous_weaponPunchAngles; 9 | 10 | NoRecoil(ConfigLoader* cl, XDisplay* display, Level* level, LocalPlayer* localPlayer) { 11 | this->cl = cl; 12 | this->display = display; 13 | this->level = level; 14 | this->localPlayer = localPlayer; 15 | } 16 | 17 | void noRecoil(int counter) { 18 | if (!cl->FEATURE_NORECOIL_ON)return; 19 | if (!localPlayer->isCombatReady()) return; 20 | if (!localPlayer->inAttack) return; 21 | FloatVector2D punchAnglesDiff = localPlayer->punchAnglesDiff; 22 | if (punchAnglesDiff.isZeroVector()) return; 23 | int pitch = (punchAnglesDiff.x > 0) 24 | ? roundHalfEven(punchAnglesDiff.x * cl->NORECOIL_PITCH_REDUCTION) 25 | : 0; 26 | int yaw = roundHalfEven(-punchAnglesDiff.y * cl->NORECOIL_YAW_REDUCTION); 27 | display->moveMouseRelative(pitch, yaw); 28 | } 29 | 30 | int roundHalfEven(float x) { 31 | return (x >= 0.0) 32 | ? static_cast(std::round(x)) 33 | : static_cast(std::round(-x)) * -1; 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /Offsets.cpp: -------------------------------------------------------------------------------- 1 | //GameVersion=v3.0.75.30 2 | #pragma once 3 | 4 | //Miscellaneous 5 | constexpr long OFF_REGION = 0x140000000; //[Static]->Region 6 | constexpr long OFF_LEVEL = 0x17e9d24; //[Miscellaneous]->LevelName 7 | constexpr long OFF_LOCAL_PLAYER = 0x22b1528; //[Miscellaneous]->LocalPlayer 8 | constexpr long OFF_ENTITY_LIST = 0x1ef8e38; //[Miscellaneous]->cl_entitylist 9 | 10 | // Buttons 11 | constexpr long OFF_IN_ATTACK = 0x07543f28; //[Buttons]->in_attack 12 | constexpr long OFF_IN_DUCK = 0x07544118; //[Buttons]->in_duck 13 | 14 | // Players 15 | constexpr long OFF_ZOOMING = 0x1be1; //[RecvTable.DT_Player]->m_bZooming 16 | constexpr long OFF_LOCAL_ORIGIN = 0x017c; //[DataMap.CBaseViewModel]->m_vecAbsOrigin 17 | constexpr long OFF_TEAM_NUMBER = 0x0338; //[RecvTable.DT_BaseEntity]->m_iTeamNum 18 | constexpr long OFF_CURRENT_HEALTH = 0x0328; //[RecvTable.DT_BaseEntity]->m_iHealth 19 | constexpr long OFF_CURRENT_SHIELDS = 0x01a0; //[RecvTable.DT_BaseEntity]->m_shieldHealth 20 | constexpr long OFF_NAME = 0x0481; //[RecvTable.DT_BaseEntity]->m_iName 21 | constexpr long OFF_LIFE_STATE = 0x0690; //[RecvTable.DT_Player]->m_lifeState 22 | constexpr long OFF_BLEEDOUT_STATE = 0x2770; //[RecvTable.DT_Player]->m_bleedoutState 23 | constexpr long OFF_LAST_VISIBLE_TIME = 0x19a0; //[RecvTable.DT_BaseCombatCharacter]->CPlayer!lastVisibleTime 24 | constexpr long OFF_LAST_AIMEDAT_TIME = 0x19a0 + 0x8; 25 | constexpr long OFF_VIEW_ANGLES = 0x2544 - 0x14; //[DataMap.C_Player]->m_ammoPoolCapacity - 0x14 26 | constexpr long OFF_PUNCH_ANGLES = 0x2448; //[DataMap.C_Player]->m_currentFrameLocalPlayer.m_vecPunchWeapon_Angle 27 | 28 | // Weapon 29 | constexpr long OFF_WEAPON_HANDLE = 0x1944; //[RecvTable.DT_BaseCombatCharacter]->m_latestPrimaryWeapons 30 | constexpr long OFF_WEAPON_INDEX = 0x1788; //[RecvTable.DT_WeaponX]->m_weaponNameIndex 31 | constexpr long OFF_WEAPON_DISCARDED = 0x15a9; //[RecvTable.DT_WeaponX]->m_discarded 32 | 33 | // Glow 34 | constexpr long OFF_GLOW_HIGHLIGHTS = 0xb0cf370; //[Miscellaneous]->HighlightSettings 35 | constexpr long OFF_GLOW_THROUGH_WALL = 0x26c; //[DT_HighlightSettings].? 36 | constexpr long OFF_GLOW_HIGHLIGHT_ID = 0x29c; //[DT_HighlightSettings].m_highlightServerActiveStates 37 | -------------------------------------------------------------------------------- /Player.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct Player { 3 | LocalPlayer* myLocalPlayer; 4 | int index; 5 | long base; 6 | std::string name; 7 | bool dead; 8 | bool knocked; 9 | int ducking; 10 | int teamNumber; 11 | int currentHealth; 12 | int currentShields; 13 | int glowEnable; 14 | int glowThroughWall; 15 | FloatVector3D localOrigin_prev; 16 | FloatVector3D localOrigin; 17 | FloatVector3D localOrigin_predicted; 18 | bool local; 19 | bool friendly; 20 | bool enemy; 21 | int lastTimeAimedAt; 22 | int lastTimeAimedAtPrev; 23 | bool aimedAt; 24 | int lastTimeVisible; 25 | int lastTimeVisiblePrev; 26 | bool visible; 27 | float distanceToLocalPlayer; 28 | float distance2DToLocalPlayer; 29 | //values used by aimbot 30 | bool aimbotLocked; 31 | FloatVector2D aimbotDesiredAngles; 32 | FloatVector2D aimbotDesiredAnglesIncrement; 33 | FloatVector2D aimbotDesiredAnglesSmoothed; 34 | FloatVector2D aimbotDesiredAnglesSmoothedNoRecoil; 35 | float aimbotScore; 36 | 37 | Player(int index, LocalPlayer* in_localPlayer) { 38 | this->index = index; 39 | this->myLocalPlayer = in_localPlayer; 40 | } 41 | 42 | void reset() { 43 | base = 0; 44 | } 45 | 46 | void readFromMemory() { 47 | base = mem::Read(OFF_REGION + OFF_ENTITY_LIST + ((index + 1) << 5), "Player base"); 48 | if (!mem::Valid(base))return; 49 | name = mem::ReadString(base + OFF_NAME, 1024, "Player name"); 50 | teamNumber = mem::Read(base + OFF_TEAM_NUMBER, "Player teamNumber"); 51 | currentHealth = mem::Read(base + OFF_CURRENT_HEALTH, "Player currentHealth"); 52 | currentShields = mem::Read(base + OFF_CURRENT_SHIELDS, "Player currentShields"); 53 | if (!isPlayer() && !isDummie()) { reset(); return; } 54 | dead = (isDummie()) ? false : mem::Read(base + OFF_LIFE_STATE, "Player dead") > 0; 55 | knocked = (isDummie()) ? false : mem::Read(base + OFF_BLEEDOUT_STATE, "Player knocked") > 0; 56 | 57 | localOrigin = mem::Read(base + OFF_LOCAL_ORIGIN, "Player localOrigin"); 58 | FloatVector3D localOrigin_diff = localOrigin.subtract(localOrigin_prev).normalize().multiply(20); 59 | localOrigin_predicted = localOrigin.add(localOrigin_diff); 60 | localOrigin_prev = FloatVector3D(localOrigin.x, localOrigin.y, localOrigin.z); 61 | 62 | glowEnable = mem::Read(base + OFF_GLOW_HIGHLIGHT_ID, "Player glowEnable"); 63 | glowThroughWall = mem::Read(base + OFF_GLOW_THROUGH_WALL, "Playeasdasdr glowThroughWall"); 64 | 65 | lastTimeAimedAt = mem::Read(base + OFF_LAST_AIMEDAT_TIME, "Player lastTimeAimedAt"); 66 | aimedAt = lastTimeAimedAtPrev < lastTimeAimedAt; 67 | lastTimeAimedAtPrev = lastTimeAimedAt; 68 | 69 | lastTimeVisible = mem::Read(base + OFF_LAST_VISIBLE_TIME, "Player lastTimeVisible"); 70 | visible = isDummie() || aimedAt || lastTimeVisiblePrev < lastTimeVisible; //aimedAt is only true when looking at unobscured target. Helps the shit in-game vis check a bit. 71 | lastTimeVisiblePrev = lastTimeVisible; 72 | 73 | if (myLocalPlayer->isValid()) { 74 | local = myLocalPlayer->base == base; 75 | friendly = myLocalPlayer->teamNumber == teamNumber; 76 | enemy = !friendly; 77 | distanceToLocalPlayer = myLocalPlayer->localOrigin.distance(localOrigin); 78 | distance2DToLocalPlayer = myLocalPlayer->localOrigin.to2D().distance(localOrigin.to2D()); 79 | if (visible) { 80 | aimbotDesiredAngles = calcDesiredAngles(); 81 | aimbotDesiredAnglesIncrement = calcDesiredAnglesIncrement(); 82 | aimbotScore = calcAimbotScore(); 83 | } 84 | } 85 | 86 | } 87 | 88 | bool isValid() { 89 | return base != 0 90 | && currentHealth > 0 91 | && (isPlayer() || isDummie()); 92 | } 93 | 94 | bool isCombatReady() { 95 | if (!isValid())return false; 96 | if (isDummie()) return true; 97 | if (dead) return false; 98 | if (knocked) return false; 99 | return true; 100 | } 101 | 102 | bool isPlayer() { 103 | return name == "player"; 104 | } 105 | 106 | bool isDummie() { 107 | return teamNumber == 97; 108 | } 109 | 110 | void setHighlightThroughWalls(bool glow) { 111 | long ptrLong = base + OFF_GLOW_THROUGH_WALL; 112 | mem::Write(ptrLong, ((glow) ? 1 : 0)); 113 | } 114 | 115 | 116 | void setHighlightIndex(int highlightIndex) { 117 | long ptrLong = base + OFF_GLOW_HIGHLIGHT_ID; 118 | mem::Write(ptrLong, highlightIndex); 119 | } 120 | 121 | FloatVector2D calcDesiredAngles() { 122 | return FloatVector2D(calcDesiredPitch(), calcDesiredYaw()); 123 | } 124 | 125 | float calcDesiredPitch() { 126 | if (local) return 0; 127 | const FloatVector3D shift = FloatVector3D(100000, 100000, 100000); 128 | const FloatVector3D originA = myLocalPlayer->localOrigin.add(shift); 129 | const float extraZ = (ducking != -1) ? 10 : 0; 130 | const FloatVector3D originB = localOrigin_predicted.add(shift).subtract(FloatVector3D(0, 0, extraZ)); 131 | const float deltaZ = originB.z - originA.z; 132 | const float pitchInRadians = std::atan2(-deltaZ, distance2DToLocalPlayer); 133 | const float degrees = pitchInRadians * (180.0f / M_PI); 134 | return degrees; 135 | } 136 | 137 | float calcDesiredYaw() { 138 | if (local) return 0; 139 | const FloatVector2D shift = FloatVector2D(100000, 100000); 140 | const FloatVector2D originA = myLocalPlayer->localOrigin.to2D().add(shift); 141 | const FloatVector2D originB = localOrigin_predicted.to2D().add(shift); 142 | const FloatVector2D diff = originB.subtract(originA); 143 | const double yawInRadians = std::atan2(diff.y, diff.x); 144 | const float degrees = yawInRadians * (180.0f / M_PI); 145 | return degrees; 146 | } 147 | 148 | FloatVector2D calcDesiredAnglesIncrement() { 149 | return FloatVector2D(calcPitchIncrement(), calcYawIncrement()); 150 | } 151 | 152 | float calcPitchIncrement() { 153 | float wayA = aimbotDesiredAngles.x - myLocalPlayer->viewAngles.x; 154 | float wayB = 180 - abs(wayA); 155 | if (wayA > 0 && wayB > 0) 156 | wayB *= -1; 157 | if (fabs(wayA) < fabs(wayB)) 158 | return wayA; 159 | return wayB; 160 | } 161 | 162 | float calcYawIncrement() { 163 | float wayA = aimbotDesiredAngles.y - myLocalPlayer->viewAngles.y; 164 | float wayB = 360 - abs(wayA); 165 | if (wayA > 0 && wayB > 0) 166 | wayB *= -1; 167 | if (fabs(wayA) < fabs(wayB)) 168 | return wayA; 169 | return wayB; 170 | } 171 | 172 | float calcAimbotScore() { 173 | return (1000 - (fabs(aimbotDesiredAnglesIncrement.x) + fabs(aimbotDesiredAnglesIncrement.y))); 174 | } 175 | 176 | void print() const { 177 | printf("____________________________________________________________________________\n"); 178 | printf("Player[%d]____base: %s\n", index, util::longToHexString(base).c_str()); 179 | printf("Player[%d]____name: %s\n", index, name.c_str()); 180 | printf("Player[%d]____dead: %d\n", index, dead); 181 | printf("Player[%d]____knocked: %d\n", index, knocked); 182 | printf("Player[%d]____ducking: %d\n", index, ducking); 183 | printf("Player[%d]____teamNumber: %d\n", index, teamNumber); 184 | printf("Player[%d]____currentHealth: %d\n", index, currentHealth); 185 | printf("Player[%d]____currentShields: %d\n", index, currentShields); 186 | printf("Player[%d]____glowEnable: %d\n", index, glowEnable); 187 | printf("Player[%d]____glowThroughWall: %d\n", index, glowThroughWall); 188 | printf("Player[%d]____localOrigin_prev: %s\n", index, localOrigin_prev.toString().c_str()); 189 | printf("Player[%d]____localOrigin: %s\n", index, localOrigin.toString().c_str()); 190 | printf("Player[%d]____localOrigin_predicted: %s\n", index, localOrigin_predicted.toString().c_str()); 191 | printf("Player[%d]____local: %d\n", index, local); 192 | printf("Player[%d]____friendly: %d\n", index, friendly); 193 | printf("Player[%d]____enemy: %d\n", index, enemy); 194 | printf("Player[%d]____lastTimeAimedAt: %d\n", index, lastTimeAimedAt); 195 | printf("Player[%d]____lastTimeAimedAtPrev: %d\n", index, lastTimeAimedAtPrev); 196 | printf("Player[%d]____aimedAt: %d\n", index, aimedAt); 197 | printf("Player[%d]____lastTimeVisible: %d\n", index, lastTimeVisible); 198 | printf("Player[%d]____lastTimeVisiblePrev: %d\n", index, lastTimeVisiblePrev); 199 | printf("Player[%d]____visible: %d\n", index, visible); 200 | printf("Player[%d]____distanceToLocalPlayer: %.2f\n", index, distanceToLocalPlayer); 201 | printf("Player[%d]____distance2DToLocalPlayer: %.2f\n", index, distance2DToLocalPlayer); 202 | printf("Player[%d]____aimbotLocked: %d\n", index, aimbotLocked); 203 | printf("Player[%d]____aimbotDesiredAngles: %s\n", index, aimbotDesiredAngles.toString().c_str()); 204 | printf("Player[%d]____aimbotDesiredAnglesIncrement: %s\n", index, aimbotDesiredAnglesIncrement.toString().c_str()); 205 | printf("Player[%d]____aimbotDesiredAnglesSmoothed: %s\n", index, aimbotDesiredAnglesSmoothed.toString().c_str()); 206 | printf("Player[%d]____aimbotDesiredAnglesSmoothedNoRecoil: %s\n", index, aimbotDesiredAnglesSmoothedNoRecoil.toString().c_str()); 207 | printf("Player[%d]____aimbotScore: %.2f\n", index, aimbotScore); 208 | printf("____________________________________________________________________________\n"); 209 | } 210 | }; 211 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Debian based dependencies 3 | 4 | ## Intall build-essential / libx11-dev / libxtst-dev (Mandatory. You only need to do this once) !!! 5 | ` 6 | sudo apt-get install build-essential libx11-dev libxtst-dev 7 | ` 8 |
9 | 10 |
11 | Arch based dependencies 12 | 13 | ## Intall base-devel / libx11 / libxtst (Mandatory. You only need to do this once) !!! 14 | ` 15 | sudo pacman -Sy base-devel libx11 libxtst 16 | ` 17 |
18 | 19 | 20 | 21 | ### 1. Download: 22 | ``` 23 | git clone https://github.com/arturzxc/grinder.git 24 | ``` 25 | 26 | ### 2. Get inside the folder 27 | ``` 28 | cd grinder 29 | ``` 30 | 31 | ### 3. Compile the program (The below is a single word command that you need to type into terminal and hit Enter): 32 | ``` 33 | make 34 | ``` 35 | 36 | ### 4. Open Apex 37 | ``` 38 | Open steam and start apex and wait for it to fully start 39 | ``` 40 | 41 | ### 5. Run the cheato 42 | ``` 43 | sudo ./a.out 44 | ``` 45 | 46 | ### 6. Profit 47 | ``` 48 | Unlimited powaaaaaaaaaa! 49 | ``` 50 | ![alt text](https://cdn.vox-cdn.com/thumbor/PYVJRRXPhua4a3I2X3n49AIgPZw=/1400x1050/filters:format(jpeg)/cdn.vox-cdn.com/uploads/chorus_asset/file/19542877/star_wars6_movie_screencaps.com_13433.jpg) 51 | -------------------------------------------------------------------------------- /Sense.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct Sense { 3 | ConfigLoader* cl; 4 | XDisplay* display; 5 | Level* level; 6 | LocalPlayer* localPlayer; 7 | std::vector* players; 8 | 9 | Sense(ConfigLoader* cl, XDisplay* display, Level* level, LocalPlayer* localPlayer, std::vector* players) { 10 | this->cl = cl; 11 | this->display = display; 12 | this->level = level; 13 | this->localPlayer = localPlayer; 14 | this->players = players; 15 | } 16 | 17 | void update() { 18 | for (int i = 0; i < players->size(); i++) { 19 | Player* p = players->at(i); 20 | if (!p->isValid()) continue; 21 | if (!p->enemy) continue; 22 | 23 | //8 bloodhound (through walls nice) 24 | //9 caustic 25 | int highlightIndex = (p->visible) ? 9 : 8; 26 | // printf("INDEX: %d", highlightIndex); 27 | p->setHighlightIndex(highlightIndex); 28 | p->setHighlightThroughWalls(true); 29 | } 30 | } 31 | 32 | 33 | }; 34 | -------------------------------------------------------------------------------- /TriggerBot.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct TriggerBot { 3 | ConfigLoader* cl; 4 | XDisplay* display; 5 | Level* level; 6 | LocalPlayer* localPlayer; 7 | std::vector* players; 8 | const float TB_MAX_RANGE_ZOOMED = util::metersToGameUnits(150); 9 | const float TB_MAX_RANGE_HIPFRE = util::metersToGameUnits(10); 10 | 11 | TriggerBot(ConfigLoader* cl, XDisplay* display, Level* level, LocalPlayer* localPlayer, std::vector* players) { 12 | this->cl = cl; 13 | this->display = display; 14 | this->level = level; 15 | this->localPlayer = localPlayer; 16 | this->players = players; 17 | } 18 | 19 | void shootAtEnemy() { 20 | if (!cl->FEATURE_TRIGGERBOT_ON) return; 21 | if (!localPlayer->isCombatReady()) return; 22 | 23 | //only these weapons will work with trigger bot 24 | int weaponId = localPlayer->weaponIndex; 25 | // printf("Last weapon held: %s id: %d \n", WeaponName(weaponId).c_str(), weaponId); 26 | if ( 27 | weaponId != WEAPON_KRABER && 28 | weaponId != WEAPON_P2020 && 29 | weaponId != WEAPON_MOZAMBIQUE && 30 | weaponId != WEAPON_EVA8 && 31 | weaponId != WEAPON_PEACEKEEPER && 32 | weaponId != WEAPON_MASTIFF && 33 | weaponId != WEAPON_WINGMAN && 34 | weaponId != WEAPON_LONGBOW && 35 | weaponId != WEAPON_SENTINEL && 36 | weaponId != WEAPON_G7 && 37 | weaponId != WEAPON_HEMLOCK && 38 | weaponId != WEAPON_3030 && 39 | weaponId != WEAPON_TRIPLE_TAKE && 40 | weaponId != WEAPON_NEMESIS 41 | )return; 42 | 43 | //max range changes based on if we are zoomed in or not 44 | const float RANGE_MAX = (localPlayer->inZoom) ? TB_MAX_RANGE_ZOOMED : TB_MAX_RANGE_HIPFRE; 45 | 46 | for (int i = 0; i < players->size(); i++) { 47 | Player* player = players->at(i); 48 | if (!player->isCombatReady()) continue; 49 | if (!player->enemy) continue; 50 | if (!player->aimedAt) continue; 51 | if (player->distanceToLocalPlayer < RANGE_MAX) { 52 | display->mouseClickLeft(); 53 | break; 54 | } 55 | } 56 | } 57 | }; 58 | -------------------------------------------------------------------------------- /Util.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | namespace util { 3 | float metersToGameUnits(float meters) { 4 | return 39.37007874 * meters; 5 | } 6 | 7 | long long currentEpochMillis() { 8 | auto currentTime = std::chrono::system_clock::now(); 9 | auto duration = currentTime.time_since_epoch(); 10 | return std::chrono::duration_cast(duration).count(); 11 | } 12 | 13 | float randomFloat(float min, float max) { 14 | std::random_device rd; 15 | std::mt19937 gen(rd()); 16 | std::uniform_real_distribution dis(min, max); 17 | return dis(gen); 18 | } 19 | 20 | std::string longToHexString(long num) { 21 | std::ostringstream oss; 22 | oss << "0x" << std::hex << std::uppercase << num; 23 | return oss.str(); 24 | } 25 | }; -------------------------------------------------------------------------------- /WeaponId.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | constexpr int WEAPON_HANDS = 120; 3 | //Sniper ammo weapons 4 | constexpr int WEAPON_SENTINEL = 1; 5 | constexpr int WEAPON_CHARGE_RIFLE = 87; 6 | constexpr int WEAPON_LONGBOW = 90; 7 | //Shotgun ammo weapons 8 | constexpr int WEAPON_MOZAMBIQUE = 102; 9 | constexpr int WEAPON_EVA8 = 93; 10 | constexpr int WEAPON_PEACEKEEPER = 109; 11 | constexpr int WEAPON_MASTIFF = 101; 12 | //Light ammo weapons 13 | constexpr int WEAPON_P2020 = 111; 14 | constexpr int WEAPON_RE45 = 85; 15 | constexpr int WEAPON_ALTERNATOR = 84; 16 | constexpr int WEAPON_R99 = 110; 17 | constexpr int WEAPON_R301 = 0; 18 | constexpr int WEAPON_SPITFIRE = 112; 19 | constexpr int WEAPON_G7 = 95; 20 | //Heavy ammo weapons 21 | constexpr int WEAPON_CAR = 118; 22 | constexpr int WEAPON_RAMPAGE = 6; 23 | constexpr int WEAPON_3030 = 117; 24 | constexpr int WEAPON_HEMLOCK = 96; 25 | constexpr int WEAPON_FLATLINE = 94; 26 | constexpr int WEAPON_PROWLER = 107; 27 | //Energy ammo weapons 28 | constexpr int WEAPON_NEMESIS = 119; 29 | constexpr int WEAPON_VOLT = 116; 30 | constexpr int WEAPON_TRIPLE_TAKE = 113; 31 | constexpr int WEAPON_LSTAR = 99; 32 | constexpr int WEAPON_DEVOTION = 89; 33 | constexpr int WEAPON_HAVOC = 91; 34 | //Legendary ammo weapons 35 | constexpr int WEAPON_WINGMAN = 114; 36 | constexpr int WEAPON_BOCEK = 2; 37 | constexpr int WEAPON_KRABER = 98; 38 | constexpr int WEAPON_THROWING_KNIFE = 173; 39 | constexpr int WEAPON_THERMITE_GRENADE = 164; 40 | 41 | // Define a reverse mapping from integer values to string names 42 | std::unordered_map intToStringMap = { 43 | {WEAPON_HANDS,"WEAPON_HANDS"}, 44 | {WEAPON_SENTINEL,"WEAPON_SENTINEL"}, 45 | {WEAPON_CHARGE_RIFLE,"WEAPON_CHARGE_RIFLE"}, 46 | {WEAPON_LONGBOW ,"WEAPON_LONGBOW"}, 47 | {WEAPON_MOZAMBIQUE,"WEAPON_MOZAMBIQUE"}, 48 | {WEAPON_EVA8,"WEAPON_EVA8"}, 49 | {WEAPON_PEACEKEEPER,"WEAPON_PEACEKEEPER"}, 50 | {WEAPON_MASTIFF,"WEAPON_MASTIFF"}, 51 | {WEAPON_P2020,"WEAPON_P2020"}, 52 | {WEAPON_RE45,"WEAPON_RE45"}, 53 | {WEAPON_ALTERNATOR,"WEAPON_ALTERNATOR"}, 54 | {WEAPON_R99 ,"WEAPON_R99"}, 55 | {WEAPON_R301,"WEAPON_R301"}, 56 | {WEAPON_SPITFIRE,"WEAPON_SPITFIRE"}, 57 | {WEAPON_G7,"WEAPON_G7"}, 58 | {WEAPON_CAR,"WEAPON_CAR"}, 59 | {WEAPON_RAMPAGE,"WEAPON_RAMPAGE"}, 60 | {WEAPON_3030,"WEAPON_3030"}, 61 | {WEAPON_HEMLOCK,"WEAPON_HEMLOCK"}, 62 | {WEAPON_FLATLINE,"WEAPON_FLATLINE"}, 63 | {WEAPON_NEMESIS,"WEAPON_NEMESIS"}, 64 | {WEAPON_VOLT,"WEAPON_VOLT"}, 65 | {WEAPON_TRIPLE_TAKE,"WEAPON_TRIPLE_TAKE"}, 66 | {WEAPON_LSTAR,"WEAPON_LSTAR"}, 67 | {WEAPON_DEVOTION ,"WEAPON_DEVOTION"}, 68 | {WEAPON_HAVOC ,"WEAPON_HAVOC"}, 69 | {WEAPON_WINGMAN ,"WEAPON_WINGMAN"}, 70 | {WEAPON_PROWLER ,"WEAPON_PROWLER"}, 71 | {WEAPON_BOCEK ,"WEAPON_BOCEK"}, 72 | {WEAPON_KRABER ,"WEAPON_KRABER"} , 73 | {WEAPON_THROWING_KNIFE,"WEAPON_THROWING_KNIFE"}, 74 | {WEAPON_THERMITE_GRENADE,"WEAPON_THERMITE_GRENADE"}, 75 | }; 76 | 77 | std::string WeaponName(int weaponId) { 78 | auto it = intToStringMap.find(weaponId); 79 | if (it != intToStringMap.end()) 80 | return it->second; 81 | return "UNKNOWN! NEED WEAPONID UPDATE!?"; 82 | } -------------------------------------------------------------------------------- /XDisplay.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | struct XDisplay { 3 | Display* display = XOpenDisplay(NULL); 4 | 5 | XDisplay() { 6 | display = XOpenDisplay(NULL); 7 | if (!display) throw std::invalid_argument("Could not open display"); 8 | } 9 | 10 | bool keyDown(int keyCode) { 11 | char keys_return[32]; 12 | XQueryKeymap(display, keys_return); 13 | KeyCode kc2 = XKeysymToKeycode(display, keyCode); 14 | bool buttonDown = !!(keys_return[kc2 >> 3] & (1 << (kc2 & 7))); 15 | return buttonDown; 16 | } 17 | 18 | bool keyDown(std::string XK_keyName) { 19 | KeySym keyCode = XStringToKeysym(trimXKPrefix(XK_keyName).c_str()); 20 | return keyDown(keyCode); 21 | } 22 | 23 | void mouseClickLeft() { 24 | XTestFakeButtonEvent(display, Button1, True, 0); 25 | XTestFakeButtonEvent(display, Button1, False, 0); 26 | XFlush(display); 27 | } 28 | 29 | bool isLeftMouseButtonDown() { 30 | Window root, child; 31 | int root_x, root_y, win_x, win_y; 32 | unsigned int mask; 33 | if (XQueryPointer(display, XRootWindow(display, DefaultScreen(display)), &root, &child, &root_x, &root_y, &win_x, &win_y, &mask)) 34 | return (mask & Button1Mask) != 0; 35 | return false; 36 | } 37 | 38 | void moveMouseRelative(int pitchMovement, int yawMovement) { 39 | XTestFakeRelativeMotionEvent(display, yawMovement, pitchMovement, CurrentTime); 40 | XFlush(display); 41 | } 42 | 43 | std::string trimXKPrefix(const std::string& keyName) { 44 | if (keyName.compare(0, 3, "XK_") == 0) 45 | return keyName.substr(3); 46 | return keyName; 47 | } 48 | 49 | 50 | }; -------------------------------------------------------------------------------- /body_styles.txt: -------------------------------------------------------------------------------- 1 | NONE(0), 2 | NOT_SURE_1(-124), 3 | NOT_SURE_2(-123), 4 | NOT_SURE_3(-122), 5 | NOT_SURE_4(-120), 6 | NOT_SURE_5(-119), 7 | NOT_SURE_6(-85), 8 | NOT_SURE_7_NOT_THROUGH_WALLS(112), 9 | NOT_SURE_8(114), 10 | MY_COLOR_PULSING_NOT_THROUGH_WALL(117), 11 | PINK(1), 12 | PINK_NOT_THROUGH_WALLS(110), 13 | MY_COLOR_ONLY_THROUGH_WALLS(2), 14 | RED_VISIBLE_GREEN_INVISIBLE_FLASHING(3), 15 | PULSING_LINE_GLOW(12), 16 | PULSING_LINE(13), 17 | BLACK(75), 18 | WAVE(103), 19 | MY_COLOR_BRIGHT(109), 20 | MY_COLOR_2_BRIGHT(118), 21 | SHARP_PULSING(124), 22 | SHARP_PULSING_THROUGH_WALLS(126); -------------------------------------------------------------------------------- /border_styles.txt: -------------------------------------------------------------------------------- 1 | NONE(0), 2 | MY_COLOR_BRIGHT(6), 3 | MY_COLOR_BRIGHT_FADES(102), 4 | MY_COLOR_DARK(101), 5 | MY_COLOR_FADES(104), 6 | PINK(1), 7 | BLUE(4), 8 | GOLD_FLASHING(5), 9 | GOLD(7), 10 | BROWN(8), 11 | GOLD_SINGLE_PIXEL(9), 12 | WAVE_EFFECT(103), 13 | RED(107), 14 | RED_BRIGHT(108), 15 | BREATHING_EFFECT(110), 16 | HEARTBEAT_EFFECT(110); -------------------------------------------------------------------------------- /grinder.ini: -------------------------------------------------------------------------------- 1 | # ENABLE/DISABLE FEATURES 2 | FEATURE_AIMBOT_ON YES #[YES,NO] Does your aim suck? 3 | FEATURE_SENSE_ON YES #[YES,NO] Do you have zero awareness? 4 | FEATURE_TRIGGERBOT_ON YES #[YES,NO] Do you pull instead of squeeze? 5 | FEATURE_NORECOIL_ON YES #[YES,NO] Want weapon kick reduction? 6 | 7 | #NORECOIL 8 | NORECOIL_PITCH_REDUCTION 2 #[0-99999] The higher the more reduction. Depends on in-game mouse 9 | NORECOIL_YAW_REDUCTION 10 #[0-99999] The higher the more reduction. Depends on in-game mouse 10 | 11 | # AIMBOT 12 | AIMBOT_ACTIVATED_BY_ATTACK YES #[YES,NO] Aimbot will be activated when shooting 13 | AIMBOT_ACTIVATED_BY_ADS YES #[YES,NO] Aimbot will activate when zooming with a weapon 14 | AIMBOT_ACTIVATED_BY_BUTTON XK_Shift_L #[Check key_codes.txt or put NONE] Aimbot will be activated when the button is held down 15 | AIMBOT_SMOOTH 120 #[1-9999] Depends on your mouse snsitivity in-game 16 | AIMBOT_SMOOTH_EXTRA_BY_DISTANCE 20000 #[0-9999] The closer the enemy the more smoothing so that aimbot doesn't look obvious when enemy is in your face. Distance based. 17 | AIMBOT_FOV 7.000 #[0.0000-180.0000] How close to the crosshairs a player has to be to get selected as a target. 18 | AIMBOT_DEADZONE 0.5 #[0.01-180.0000] Deadzone. If we are close enough then stop aimbot from trying to get any closer. If you have very low smoothing then you might want to up this to prevent 'shaking' 19 | AIMBOT_MAX_DISTANCE 200 #[0-9999] Aimbot will not work if the target is too far. Units are meters. 20 | AIMBOT_MIN_DISTANCE 5 #[0-9999] Aimbot will not work if the target is too close. Units are meters. 21 | 22 | # SENSE 23 | SENSE_ENEMY_COLOR_SHIELD_BASED NO #[YES,NO] If true then enemies will have current shield color, otherwise, colors below will be used 24 | # Keep in mind that some body styles and borders have predefined colors that cannot be changed. 25 | # In addition, certain body styles/border styles do not go through walls no matter what 26 | # Certain other style are only visible not through walls no matter what. 27 | SENSE_ENEMY_VISIBLE_COLOR_RED 0 #[0-100] Color intensity. 28 | SENSE_ENEMY_VISIBLE_COLOR_GREEN 10 #[0-100] Color intensity. 29 | SENSE_ENEMY_VISIBLE_COLOR_BLUE 0 #[0-100] Color intensity. 30 | SENSE_ENEMY_VISIBLE_BODY_STYLE 2 #[Check body_styles.txt] Predefined body style 31 | SENSE_ENEMY_VISIBLE_BORDER_STYLE 6 #[Check border_styles.txt] Predefined border style. 32 | SENSE_ENEMY_VISIBLE_BORDER_WIDTH 32 #[0-127] Character outline width. 33 | 34 | SENSE_ENEMY_INVISIBLE_COLOR_RED 10 #[0-100] Color intensity. 35 | SENSE_ENEMY_INVISIBLE_COLOR_GREEN 0 #[0-100] Color intensity. 36 | SENSE_ENEMY_INVISIBLE_COLOR_BLUE 0 #[0-100] Color intensity. 37 | SENSE_ENEMY_INVISIBLE_BODY_STYLE 2 #[Check body_styles.txt] Predefined body style. 38 | SENSE_ENEMY_INVISIBLE_BORDER_STYLE 108 #[Check border_styles.txt] Predefined border style. 39 | SENSE_ENEMY_INVISIBLE_BORDER_WIDTH 32 #[0-127] Character outline width. 40 | 41 | SENSE_ENEMY_LOCKEDON_COLOR_RED 10 #[0-100] Color intensity. 42 | SENSE_ENEMY_LOCKEDON_COLOR_GREEN 10 #[0-100] Color intensity. 43 | SENSE_ENEMY_LOCKEDON_COLOR_BLUE 10 #[0-100] Color intensity. 44 | SENSE_ENEMY_LOCKEDON_BODY_STYLE 2 #[Check body_styles.txt] Predefined body style. 45 | SENSE_ENEMY_LOCKEDON_BORDER_STYLE 109 #[Check border_styles.txt] Predefined border style. 46 | SENSE_ENEMY_LOCKEDON_BORDER_WIDTH 32 #[0-127] Character outline width. 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /includes.hpp: -------------------------------------------------------------------------------- 1 | //system libs 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | //my stuff 31 | #include "ConfigLoader.cpp" 32 | #include "Offsets.cpp" 33 | #include "WeaponId.cpp" 34 | #include "Util.cpp" 35 | #include "FloatVector2D.cpp" 36 | #include "FloatVector3D.cpp" 37 | #include "Highlight.cpp" 38 | #include "Color.cpp" 39 | #include "Memory.cpp" 40 | #include "XDisplay.cpp" 41 | #include "Level.cpp" 42 | #include "HighlightList.cpp" 43 | #include "LocalPlayer.cpp" 44 | #include "Player.cpp" 45 | #include "Sense.cpp" 46 | #include "TriggerBot.cpp" 47 | #include "AimBot.cpp" 48 | #include "NoRecoil.cpp" 49 | --------------------------------------------------------------------------------