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 


[Help] Compare 2 addresses

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

Joined: 08 May 2020
Posts: 5
Location: Anywhere

PostPosted: Mon Aug 02, 2021 10:52 am    Post subject: [Help] Compare 2 addresses Reply with quote

Hey guys
I want to make an One Hit Kill script for a game, and i want to use my health address to differentiate myself from the others
But when i try to compare My Health Address with Target Health Address, game crash.

This is my script:

Code:
[ENABLE]

aobscanmodule(OHK,GameAssembly.dll,C4 08 89 48 18 5D C3) // should be unique
alloc(newmem,$1000)

label(origin)
label(return)
label(_ohk)
label(_p_Heal)
label(target)



newmem:
// Get my Health Address
  push edx
  lea edx,[[_pHealth]+18]  // "_pHealth" its Player Base Address and 0x18 its the Health offset
  mov [_p_Heal],edx
  pop edx

// Get others Health Address
  push edx
  mov edx,eax
  lea edx,[edx+18] // "edx+18" its others health address
  mov [target],edx
  pop edx

  cmp target,_p_Heal // Here its the problem, when i compare these 2, game crashes
  jne _ohk
  mov [eax+18],ecx
  pop ebp
  ret
  jmp return

_ohk:
  mov [eax+18],00
  pop ebp
  ret
  jmp return

origin:
  mov [eax+18],ecx
  pop ebp
  ret
  jmp return

_p_Heal:
dq 0

target:
dq 0

OHK+02:
  jmp newmem
return:
registersymbol(OHK _p_Heal target)

[DISABLE]

OHK+02:
  db 89 48 18 5D C3

unregistersymbol(OHK _p_Heal target)
dealloc(newmem)


If someone can help me, I would appreciate Smile
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon Aug 02, 2021 4:27 pm    Post subject: Reply with quote

I'm thinking this should work.
Code:
[ENABLE]

aobscanmodule(OHK,GameAssembly.dll,C4 08 89 48 18 5D C3) // should be unique
alloc(newmem,$1000)

// label(origin)
label(return)
label(_ohk)
label(target)



newmem:
  cmp [_pHealth],eax
  jne _ohk
  mov [eax+18],ecx
  pop ebp
  ret
  jmp return

_ohk:
  mov [eax+18],00
  pop ebp
  ret
  jmp return

// origin:
//   mov [eax+18],ecx
//   pop ebp
//   ret
//   jmp return


OHK+02:
  jmp newmem
return:
registersymbol(OHK)

[DISABLE]

OHK+02:
  db 89 48 18 5D C3

unregistersymbol(OHK)
dealloc(newmem)

_________________
Back to top
View user's profile Send private message Visit poster's website
Hadaar
How do I cheat?
Reputation: 0

Joined: 08 May 2020
Posts: 5
Location: Anywhere

PostPosted: Tue Aug 03, 2021 8:25 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:
~


Thanks for your answer, but that solution its not working.

It's like the script jumps every time, without compare.

I tried this script.
With this he "je" every time, even if My Base Addres and Other Base Address are different.

Code:
[ENABLE]

aobscanmodule(OHK,GameAssembly.dll,C4 08 89 48 18 5D C3) // should be unique
alloc(newmem,$1000)

// label(origin)
label(return)
label(_ohk)
label(cmpFlag)
label(target2)
label(test1)


newmem:
// Get others Base address
  push edx
  mov edx,eax
  mov [target2],edx
  pop edx

  cmp [_pHealth],eax
  je test1 // He jump always, even if those 2 addresses are different
  mov [cmpFlag],00
  mov [eax+18],00
  pop ebp
  ret
  jmp return

test1:
  mov [cmpFlag],01 // This flag its always 1, so that script jump every time.
  jmp _ohk

_ohk:
  mov [eax+18],ecx
  pop ebp
  ret
  jmp return

cmpFlag:
db 0

target2:
db 0

// origin:
//   mov [eax+18],ecx
//   pop ebp
//   ret
//   jmp return


OHK+02:
  jmp newmem
return:
registersymbol(OHK cmpFlag target2)

[DISABLE]

OHK+02:
  db 89 48 18 5D C3

unregistersymbol(OHK target target2)
dealloc(newmem)
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Tue Aug 03, 2021 3:57 pm    Post subject: Reply with quote

At this point you should set a breakpoint and step though the code to see what's going on.
_________________
Back to top
View user's profile Send private message Visit poster's website
Birdi
Expert Cheater
Reputation: 0

Joined: 08 Jun 2020
Posts: 122
Location: Migrating

PostPosted: Wed Aug 04, 2021 2:42 am    Post subject: Reply with quote

As above, you can just step through the function with a breakpoint to find out why the cmp is valid or not, in both cases.

If you'd like more specific help you could namedrop the game and see if we can help directly.
Back to top
View user's profile Send private message Visit poster's website
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