Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Finding Address Of A Value In A Self Written Game

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
da_cL0ner
How do I cheat?
Reputation: 0

Joined: 28 Jan 2019
Posts: 4

PostPosted: Mon Jan 28, 2019 9:56 am    Post subject: Finding Address Of A Value In A Self Written Game Reply with quote

Hey there,
I've written a simple game which the health is decreased or increased using buttons. I started to hack the health value but couldn't find it.
I've tried enabling Or disabling fast scan & All types of values including byte, 2 byte, 4 byte, 8 byte, float, double & string but none of them showed me the value Sad
I guess that the value is string but I tried string scanning with & without "Case Sensitive", "Writable", "Executable", "CopyOnWrite" options
Can Anyone out here help me find it?

The Game is written in windows form C# and the code for decreasing life is:

Code:

    private void button1_Click(object sender, EventArgs e)
    {
      if (this.label4.Text != "0")
      {
        if (this.label4.Text == "10")
          this.label4.Text = "0";
        if (this.label4.Text == "20")
          this.label4.Text = "10";
        if (this.label4.Text == "30")
          this.label4.Text = "20";
        if (this.label4.Text == "40")
          this.label4.Text = "30";
        if (this.label4.Text == "50")
          this.label4.Text = "40";
        if (this.label4.Text == "60")
          this.label4.Text = "50";
        if (this.label4.Text == "70")
          this.label4.Text = "60";
        if (this.label4.Text == "80")
          this.label4.Text = "70";
        if (this.label4.Text == "90")
          this.label4.Text = "80";
        if (this.label4.Text == "100")
          this.label4.Text = "90";
      }



where button1 is the button that decreases health & label4.Text is representing health value.

Thank You...

_________________
Nothing Is True;
Every Thing Is Permitted
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1586

PostPosted: Mon Jan 28, 2019 2:02 pm    Post subject: Reply with quote

this is not a useful post, but if you cant hack your own program .. then .....
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote:
i am a sweetheart.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25806
Location: The netherlands

PostPosted: Mon Jan 28, 2019 3:05 pm    Post subject: Reply with quote

strings are difficult because they get reallocated when replaced by a different string
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
da_cL0ner
How do I cheat?
Reputation: 0

Joined: 28 Jan 2019
Posts: 4

PostPosted: Mon Jan 28, 2019 4:35 pm    Post subject: Reply with quote

Thanks Dark Byte for your reply,
I'm kinda new in your cool CE so can you show me a way on how to find the value address for this? Rolling Eyes
Back to top
View user's profile Send private message
LeonBlade
How do I cheat?
Reputation: 0

Joined: 25 Jan 2019
Posts: 9

PostPosted: Mon Jan 28, 2019 8:04 pm    Post subject: Reply with quote

First off, I think you might want to reconsider how you're programming the health, that will save you a lot of hassle. If string memory is reallocated randomly then that means the only way you can "hack" your health value is to change the assembly instructions to stop it from doing that.

The reason you couldn't scan for number values if because you don't have a single number type in that function.

If you want to use a number for your health value instead, you'll be able to "hack" it a lot easier. You would define a variable for health outside of your function and then do arithmetic on it every time you click as you are now and update the label to equal your health variable.

Code:

int myHealth = 100;

private void button1_Click(object sender, EventArgs e)
{
    // don't go under 0 health
    if (myHealth > 0)
    {
        myHealth -= 10;
        this.label4.Text = myHealth.ToString();
    }
}


This isn't the best way, but it's a start in the right direction. If you make these changes you'll find that if you scan for a 4 byte value for your number you'll find your health. This is because you're finding the variable "myHealth" in memory. Now you could change it to 1000 for example and next time you click your button it will be 990 (because it subtracts 10 from 1000).

I hope this helps however way you want to approach this problem.[/code]
Back to top
View user's profile Send private message
da_cL0ner
How do I cheat?
Reputation: 0

Joined: 28 Jan 2019
Posts: 4

PostPosted: Tue Jan 29, 2019 2:08 am    Post subject: Reply with quote

LeonBlade wrote:
First off, I think you might want to reconsider how you're programming the health, that will save you a lot of hassle. If string memory is reallocated randomly then that means the only way you can "hack" your health value is to change the assembly instructions to stop it from doing that.

The reason you couldn't scan for number values if because you don't have a single number type in that function.

If you want to use a number for your health value instead, you'll be able to "hack" it a lot easier. You would define a variable for health outside of your function and then do arithmetic on it every time you click as you are now and update the label to equal your health variable.

Code:

int myHealth = 100;

private void button1_Click(object sender, EventArgs e)
{
    // don't go under 0 health
    if (myHealth > 0)
    {
        myHealth -= 10;
        this.label4.Text = myHealth.ToString();
    }
}


This isn't the best way, but it's a start in the right direction. If you make these changes you'll find that if you scan for a 4 byte value for your number you'll find your health. This is because you're finding the variable "myHealth" in memory. Now you could change it to 1000 for example and next time you click your button it will be 990 (because it subtracts 10 from 1000).

I hope this helps however way you want to approach this problem.[/code]



LeonBlade, Thank you so much for your reply & I appreciate it Wink
But I have already tried hacking integer type values & I'm trying to learn hacking/editing string type values.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25806
Location: The netherlands

PostPosted: Tue Jan 29, 2019 2:15 am    Post subject: Reply with quote

Try a different programming language to learn that first, or use a different form of assigning.

e.g
Code:

this.label4.Text = myHealth.ToString();

Will change the pointer of label4.Text because it reallocates the string

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
da_cL0ner
How do I cheat?
Reputation: 0

Joined: 28 Jan 2019
Posts: 4

PostPosted: Tue Jan 29, 2019 2:32 am    Post subject: Reply with quote

Dark Byte wrote:
Try a different programming language to learn that first, or use a different form of assigning.

e.g
Code:

this.label4.Text = myHealth.ToString();

Will change the pointer of label4.Text because it reallocates the string


Alright then, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites