Solved Float value

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

KR4N3N64

Newbie
Full Member
Oct 3, 2012
9
232
0
Hi all, how can i write float value with this function: WriteProcessMemory(hProcHandle, address, value, sizeof(value), null) ?? thx
 

NubTIK

Jr.Coder
Full Member
Nobleman
Dec 5, 2012
58
1,573
1
Float Values

I cant seem to undesrtand why this would be an issue:

C++:
float Value = 2.0f; 
float ValueArray[3] = {2.0f, 3.0f, 4.0f};
Writing the normal Float Value

C++:
WriteProcessMemory (Process, (LPVOID)(Address), &Value, sizeof(float), 0);
Writing the Float Array Value
C++:
WriteProcessMemory (Process, (LPVOID)(Address), &ValueArray, sizeof(float[3]), 0);
 
Last edited:

thegood

Newbie
Full Member
Oct 22, 2012
6
422
0
The question is, wether the program you want to hack, accept float values !?

Ok, float values are not given in the memory, there are just values, who "describe" the float value!
The function "WriteProcessMemory" only accepts LPCVOID, i thik this should be a 4 byte value !?
So we have to convert the float number to a 4 byte value:

#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
float fNumber = 3.141; //type in your number you want to "hack" here
float *pointer = &fNumber; //pointer to this number
int *intpointer = (int *) pointer; //cast to int-pointer

cout<<"Value as float: "<<*pointer<<" Value as 4-byte-integer: "<<*intpointer<<endl;
//you can get now the memory of the float-value as int-value

system("pause");

return 0;
}

the value as 4-byte-integer you can type in into the WriteProcessMemory-function
I hope this will work.

thegood
 
Last edited:

KR4N3N64

Newbie
Full Member
Oct 3, 2012
9
232
0
Hi, im trying to hack gta sa and the health bar is a float value but i cant write a value with WriteProcessMemory function. and i dont understand how to use your code, im new in c++.. Sry for my english

Note: The address has only one offset
 
Last edited:

Typ3Cast

Newbie
Oct 15, 2012
4
234
0

thegood

Newbie
Full Member
Oct 22, 2012
6
422
0
mh, cant help you now, maybe you can send some screenshots, code or memory regions ?!
 

NubTIK

Jr.Coder
Full Member
Nobleman
Dec 5, 2012
58
1,573
1
The question is, wether the program you want to hack, accept float values !?

Ok, float values are not given in the memory, there are just values, who "describe" the float value!
The function "WriteProcessMemory" only accepts LPCVOID, i thik this should be a 4 byte value !?
So we have to convert the float number to a 4 byte value:

#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
float fNumber = 3.141; //type in your number you want to "hack" here
float *pointer = &fNumber; //pointer to this number
int *intpointer = (int *) pointer; //cast to int-pointer

cout<<"Value as float: "<<*pointer<<" Value as 4-byte-integer: "<<*intpointer<<endl;
//you can get now the memory of the float-value as int-value

system("pause");

return 0;
}

the value as 4-byte-integer you can type in into the WriteProcessMemory-function
I hope this will work.

thegood
Good post, I just wanna point out that LPCVOID Is NOT The only thing it accepts... what about PBYTE* ?
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods