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 


[solved] use a varaible for a pointer offset

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

Joined: 07 May 2020
Posts: 2

PostPosted: Thu May 07, 2020 6:57 pm    Post subject: [solved] use a varaible for a pointer offset Reply with quote

i want to use a variable to calculate an address offset

in the trainer you are able to enter your player number
(12 players on the server, you join, so your player number will be 13)

now i have to convert the player number into an hex offset

Code:

xOffset=playerNumber*0x8+0x4
xHex=string.format("%X", xOffset)
local xPos = readFloat("[game.exe+001829A4]+xHex")


if your player number is 1 xHex should be C, but running this code like this does not work for some reason
but it does work if xHex is 8 for example

is there a way i can use hex variables as an offset?


Last edited by snoutie on Fri May 08, 2020 5:59 am; edited 1 time in total
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4725

PostPosted: Thu May 07, 2020 8:38 pm    Post subject: Reply with quote

Code:
local xPos = readFloat(("[game.exe+001829A4]+%X"):format(playerNumber*0x8+0x4))

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
snoutie
How do I cheat?
Reputation: 0

Joined: 07 May 2020
Posts: 2

PostPosted: Fri May 08, 2020 6:00 am    Post subject: Reply with quote

you are a legend, thank you so much
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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