View previous topic :: View next topic |
Author |
Message |
EntityReborn How do I cheat?
Reputation: 0
Joined: 15 Aug 2010 Posts: 9
|
Posted: Wed Oct 16, 2013 2:19 pm Post subject: Process Exit detection. |
|
|
Is there currently a way to tell when a process you are attached to exits? I'd like to make my trainer re-attach if the target dies and is restarted.
|
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Wed Oct 16, 2013 3:59 pm Post subject: |
|
|
just create a timer that opens the process every second.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
EntityReborn How do I cheat?
Reputation: 0
Joined: 15 Aug 2010 Posts: 9
|
Posted: Wed Oct 16, 2013 4:21 pm Post subject: |
|
|
Code: | t = createTimer(nil)
timer_onTimer(t, checkAttached)
timer_setInterval(t, 1000)
timer_setEnabled(t, true)
pid = 0
function onOpenProcess(id)
if (id ~= pid) then
pid = id
print("Connected")
end
end
function checkAttached()
print("Checking...")
openProcess( "JustCause2.exe" )
local newpid = getOpenedProcessID()
print("oldpid:"..pid)
print("newpid:"..newpid)
end |
With this above code, even after I close the target, newpid remains set as the old id. IOW, newpid == pid.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25796 Location: The netherlands
|
Posted: Wed Oct 16, 2013 5:18 pm Post subject: |
|
|
checkAttached never gets called because it‘s not yet declared when you assign it to the timer
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
EntityReborn How do I cheat?
Reputation: 0
Joined: 15 Aug 2010 Posts: 9
|
Posted: Wed Oct 16, 2013 5:19 pm Post subject: |
|
|
This is just a small piece of code, from a larger chunk. I do indeed get the print statements in the Lua console.
EDIT:
Also, could you somehow include an environment reset for testing scripts? One example of this is, hitting Execute script in the script editor causes previous timers to keep ticking, etc. If possible, a full environment reload such as when loading a script from file would be excellent, with a seperate button.
|
|
Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Thu Oct 17, 2013 11:13 am Post subject: |
|
|
you can destroy timers.
and resetLuaState can also help.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
Back to top |
|
 |
|