BR13Vinicius How do I cheat? Reputation: 0
Joined: 21 Mar 2017 Posts: 1 Location: Joao Pessoa - Paraiba, Brazil
|
Posted: Tue Mar 21, 2017 11:54 am Post subject: How to tell if the process is the correct one on lua table |
|
|
Hello i'm such a newbie at Lua I was trying to make this lua 'trainer' thingy using the lua table and i'm having some issues i'm using the wiki to help me but the wiki doesn't help that much
What i'm trying to do:
Code: | openProcess("1.exe")
if getNameFromAddress(2) then
print("Hooked!")
else
print("Failed to hook!")
end |
What i want it to do:
I want it to say "Hooked" if the process that it hooked is "1.exe" but it always return hooked even if the process on getNameFromAdress is 2
I was wondering if i could get some advice on how to do this / get an working command or an example so i could learn from it and make this lua project
Thank you
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 941
|
Posted: Tue Mar 21, 2017 12:58 pm Post subject: |
|
|
From CE 6.5+, at main.lua @ your CE installed directory
Code: |
process : A variable that contains the main modulename of the currently opened process
|
So
Code: |
if process == "<exact.process.name>" then
... -- do right process attached
elseif process == nil then
... -- do no process attached
else
... -- do wrong process attached
end
|
can detect if the right process has been attached....
but if the process then detached (eg.close by itself), the variable will be still the previous attached name.
To detect this we can read some memory from the process, whose a handy address is given by the variable itself, so
Code: |
if process == "<exact.process.name>" then
if readInteger(process) then -- return nil if not readable, which same as false
... -- do right process attached
else -- do right process has been detached
...
end
elseif process == nil then
... -- do no process attached
else
... -- do wrong process attached
end
|
For case-insensitive compare/find match, try this:
Code: |
if process and process:lower():find("<optional partial, lower case process name>",1,true) then
...
|
eg, partial lower case process name for "cheatengine-x86_64.exe" is like "cheatengine", for "Microsoft.Photos.exe" like "photos".
_________________
- Retarded. |
|