So i've been trying to read some values y'know like health and armor and it worked perfectly but when i tried to read my kills things got weird...Unlike printing out Health and armour values normally, when trying to print the value of my kills i just got some random numbers that weren't changing and i'd like to know how to convert them to "normal" values...and yeah i am new to this so ofc my code is far from perfect but please focus on this problem and leave critisism somewhere else..thank you.
Code:
// chit.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "ConsoleColor.h"
#include <Windows.h>
using namespace std;
int main()
{
HWND hwnd = FindWindowA(NULL, "Counter-Strike: Global Offensive");
if (hwnd == NULL) {
cout << "Cannot find window." << endl;
Sleep(3000);
exit(-1);
}
else
{
DWORD procsID;
GetWindowThreadProcessId(hwnd, &procsID);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procsID);
if (procsID = NULL) {
cout << "Cannot obtain process." << endl;
Sleep(3000);
exit(-1);
}
else
{
//health
DWORD lajfPointer = 0x00AA00FC; //life pointer
DWORD lajfPointed; //that other thingy
WORD lajfOffset = 0x000000FC; //life offset
int currentLajf; //int
//////////////////////////////
DWORD armoroffset = 0x0000B238;
DWORD armorpointed;
int currentArmor;
DWORD shotsoffset = 0x0000A2B0;
DWORD shotspointed;
int shots;
DWORD killoffset = 0x00000BE8;
DWORD killpointed;
int kill;
//////////////////////////////
DWORD clientNaslov = 0x1EC60000; //vedn drug, client.dll
DWORD LokalniIgralec = 0x00AA00FC; //local player
DWORD LokalnaBaza = LokalniIgralec + clientNaslov; //local base
while (true) {
ReadProcessMemory(handle, (LPCVOID)(LokalnaBaza), &lajfPointed, 4, NULL);
ReadProcessMemory(handle, (LPCVOID)(lajfPointed + lajfOffset), ¤tLajf, 4, NULL);
///////////////////
////
ReadProcessMemory(handle, (LPCVOID)(LokalnaBaza), &armorpointed, 4, NULL);
ReadProcessMemory(handle, (LPCVOID)(armorpointed + armoroffset), ¤tArmor, 4, NULL);
////
ReadProcessMemory(handle, (LPCVOID)(LokalnaBaza), &shotspointed, 4, NULL);
ReadProcessMemory(handle, (LPCVOID)(shotspointed + shotsoffset), &shots, 4, NULL);
////
ReadProcessMemory(handle, (LPCVOID)(LokalnaBaza), &killpointed, 4, NULL);
ReadProcessMemory(handle, (LPCVOID)(killpointed + killoffset), &kill, 4, NULL);
///////////////////
system("cls");
if (currentLajf == 0) {
cout << white <<"Current Health is: " << red << "DEAD" << endl;
}
else if (currentLajf <= 20) {
cout << white << "Current Health is: " << red << currentLajf << endl;
cout << white << "Current Armor is " << red << currentArmor << endl;
}
else if (currentLajf <= 50) {
cout << white << "Current Health is: " << yellow << currentLajf << endl;
cout << white << "Current Armor is " << green << currentArmor << endl;
}
else
{
cout << white << "Current Health is: " << green << currentLajf << endl;
cout << white << "Current Armor is: " << green << currentArmor << endl;
cout << white << "Shots fired: " << green << shots << endl;
cout << white << "Test: " << green << kill << endl;
}
}
}
system("PAUSE");
}
return 0;
}