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 


Why does this script crash my game?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
The Dab
Cheater
Reputation: 0

Joined: 22 May 2017
Posts: 33

PostPosted: Wed Jul 26, 2017 12:00 pm    Post subject: Why does this script crash my game? Reply with quote

This is an attempt at a teleport script. What this script does is move the coordinates of the player into "xpos", "zpos", and "ypos" when the value of "vsave" is set to 1 in the address list. (vsave is set to 1 using a hotkey). Same goes for "vload" except that it takes what was saved when "vsave" was activated and puts it in to the address of the coordinates. This should teleport you to where you last saves your coordinates, but instead it crashes the game. Any help?


Code:

[ENABLE]

aobscanmodule(TELEPORT,server.dll,3C F3 FF D9 07 8B C6 D9 1E D9 47 04 D9 5E 04 D9 47 08 5F D9 5E 08 5E 5B) // should be unique
alloc(newmem,$1000)
alloc(storepos,256)

label(code)
label(return)
label(storepos)
label(xpos)
label(ypos)
label(zpos)
label(vsave)
label(vload)
label(save)
label(load)
registersymbol(vsave)
registersymbol(vload)

load:
mov [vload],0
push edi
mov edi,[zpos]
mov [esi+00],edi
mov edi,[xpos]
mov [esi+04],edi
mov edi,[ypos]
mov [esi+08],edi
pop edi
jmp code

save:
mov [vsave],0
push edi
mov edi,[esi+00]
mov [zpos],edi
mov edi,[esi+04]
mov [xpos],edi
mov edi,[esi+08]
mov [ypos],edi
pop edi
jmp code


vload:
dd 0

vsave:
dd 0

storepos:
xpos:
dd 0
ypos:
dd 0
zpos:
dd 0

newmem:
cmp [vsave],1
je save
cmp [vload],1
je load
jmp code

code:
  fstp dword ptr [esi+08]
  pop esi
  pop ebx
  jmp return

TELEPORT+13:
  jmp newmem
return:
registersymbol(TELEPORT)

[DISABLE]

TELEPORT+13:
  db D9 5E 08 5E 5B

unregistersymbol(TELEPORT)
dealloc(newmem)
unregistersymbol(vsave)
unregistersymbol(vload)
dealloc(storepos,256)
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 26, 2017 1:59 pm    Post subject: Reply with quote

Just glancing, you might try to rearrange some things, first:

Code:
[ENABLE]

aobscanmodule(TELEPORT,server.dll,3C F3 FF D9 07 8B C6 D9 1E D9 47 04 D9 5E 04 D9 47 08 5F D9 5E 08 5E 5B) // should be unique
alloc(newmem,$1000)
alloc(storepos,256)

label(code)
label(return)
label(storepos)
label(xpos)
label(ypos)
label(zpos)
label(vsave)
label(vload)
label(save)
label(load)
registersymbol(vsave)
registersymbol(vload)



newmem:
cmp [vsave],1
je save
cmp [vload],1
je load
jmp code

load:
mov [vload],0
cmp [zpos],0
je code
push edi
mov edi,[zpos]
mov [esi+00],edi
mov edi,[xpos]
mov [esi+04],edi
mov edi,[ypos]
mov [esi+08],edi
pop edi
jmp code

save:
mov [vsave],0
push edi
mov edi,[esi+00]
mov [zpos],edi
mov edi,[esi+04]
mov [xpos],edi
mov edi,[esi+08]
mov [ypos],edi
pop edi
jmp code

code:
fstp dword ptr [esi+08]
pop esi
pop ebx
jmp return

vload:
dd 0

vsave:
dd 0

storepos:
xpos:
dd 0
ypos:
dd 0
zpos:
dd 0
 
TELEPORT+13:
jmp newmem
return:
registersymbol(TELEPORT)

[DISABLE]

TELEPORT+13:
dealloc(newmem)
dealloc(storepos,256)
db D9 5E 08 5E 5B

unregistersymbol(TELEPORT)
unregistersymbol(vsave)
unregistersymbol(vload)
Back to top
View user's profile Send private message
Prehistoricman
Advanced Cheater
Reputation: 0

Joined: 02 Aug 2016
Posts: 80

PostPosted: Wed Jul 26, 2017 4:16 pm    Post subject: Reply with quote

Why are you popping esi and ebx in code?

Ordering is important here because you're describing how your code will be laid out in memory. METHOS's code should solve a couple issues. Although, I don't understand why you'd put dealloc in this location

Quote:
Code:
TELEPORT+13:
 dealloc(newmem)
 dealloc(storepos,256)
 db D9 5E 08 5E 5B

_________________
Er, hi
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Wed Jul 26, 2017 6:36 pm    Post subject: Reply with quote

The relocation of dealloc was unintentional and done in error. Regarding the register pops, that is part of the original instruction.
Back to top
View user's profile Send private message
OldCheatEngineUser
Whateven rank
Reputation: 20

Joined: 01 Feb 2016
Posts: 1587

PostPosted: Wed Jul 26, 2017 11:56 pm    Post subject: Reply with quote

i dont know what you did with the script guys, but i did few tele hacks before.
its very important to pick up the right instruction to inject your dirty code.

wether you try with instruction that writes to the address or access.

just try on different one until it works. picking up the wrong instruction for injection can crash your game.

just keep in mind this, it may help or try it out now.

_________________
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
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