 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Starter_But Advanced Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 53
|
Posted: Sat Jul 01, 2023 2:47 am Post subject: Lua code for the cheat engine trainer |
|
|
Hello, there is an assembler code that works correctly when activated
| Code: |
define(address, Terraria.NPC::StrikeNPC+724)
define(bytes, 29 86 0C 01 00 00)
[ENABLE]
assert(address, bytes)
alloc(newmem, 1)
label(code)
label(return)
newmem:
code:
sub [esi+10C],#999999
jmp return
address:
jmp newmem
nop
return:
[DISABLE]
address:
db bytes
//sub [esi+10C],eax
dealloc(*)
|
Using this code, I decided to create a trainer, the code for which will be activated by the checkbox
| Code: |
local address = "Terraria.NPC::StrikeNPC+724"
local bytes = "29 86 0C 01 00 00"
local originalBytes = readBytes(address, #bytes)
function enable()
writeBytes(address, bytes)
end
function disable()
writeBytes(address, originalBytes)
end
if CETrainer.rPlayerOneHit.Checked then
enable()
else
disable()
|
But for some reason, when activating this code, nothing happens or the code works differently, what did I do wrong in the lua code?
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Sat Jul 01, 2023 3:00 am Post subject: |
|
|
| Code: | local origBytes
local sOnEnable = [[
globalalloc(rPlayerOneHit, 40)
rPlayerOneHit:
sub [esi+10C], #999999
jmp return
"Terraria.NPC::StrikeNPC"+724:
jmp rPlayerOneHit
nop
return:
]]
local sOnDisable = [[
dealloc(rPlayerOneHit)
unregisterSymbol(rPlayerOneHit)
]]
if CETrainer.rPlayerOneHit.Checked then
origBytes = readBytes("Terraria.NPC::StrikeNPC+724", 6)
autoAssemble(sOnEnable)
else
autoAssemble(sOnDisable)
writeBytes("Terraria.NPC::StrikeNPC+724", origBytes)
end |
|
|
| Back to top |
|
 |
Starter_But Advanced Cheater
Reputation: 0
Joined: 26 Oct 2021 Posts: 53
|
Posted: Sat Jul 01, 2023 3:16 am Post subject: |
|
|
| Frouk wrote: | | Code: |
globalalloc(rPlayerOneHit, 40)
|
|
Thank you, but why did you take 40?
|
|
| Back to top |
|
 |
|
|
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
|
|