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 


Set Hack Active

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Fri Feb 15, 2019 11:26 pm    Post subject: Set Hack Active Reply with quote

I have this code :

Code:
function test_hack()
 s = AOBScan("66 66 AE 10", "+W*X-C")
 if (s) then
 lngt = s.getCount()
 for x=0, lngt-1, 1 do
 writeBytes(s[x], 0xE1, 0xEA, 0x1C, 0x10)
 btn1Active = not btn1Active
 for index, s in ipairs(btn1) do
    s.Active = btn1Active
  end
 end
 lbl1.caption = 'Hack Active'
 beep()
 s.Destroy()
 s = nil
 else
 lbl1.caption = 'Hack Not Active'
 return
end
end


with that code hack active just for first time then return to original AOB after did a step on the game.
But by using hack table on CE default, that AOB remain active when set hack active checked, it will return to original AOB when set hack active uncheck.

How make hack remain active by lua ?.
if use AA, I am not familiar to use it.
Thanks

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sat Feb 16, 2019 1:28 am    Post subject: Reply with quote

use a [enable] / [disable] section
and in each section use {$lua} blocks only

in enable do what you do above, but don't destroy s (and remove some of the gui stuff and in case if no results do an error() call to prevent setting to active)

then in disable check if s exists and if so go through that same list again and restore with the original bytes, and only then destroy s

_________________
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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Feb 16, 2019 2:42 am    Post subject: Reply with quote

Thanks DB

Tried :

Code:

[ENABLE]
{$lua}

s = AOBScan("66 66 AE 10", "+W*X-C")

if s == nil then
   showMessage('Not Found')
   s.Destroy()
end

if (s) then
 lngt = s.getCount()
  for x=0, lngt-1, 1 do
  writeBytes(s[x], 0xE1, 0xEA, 0x1C, 0x10)
--  btn1Active = not btn1Active
--  for index, s in ipairs(btn1) do
--    s.Active = btn1Active
--  end
 end

-- lbl1.caption = 'Hack Active'
-- beep()
-- s.Destroy()
-- s = nil
-- else
-- lbl1.caption = 'Hack Not Active'
-- return
end
[DISABLE]


Hack active for first time only when AOB found and changed.
I considering to use timer to set hack always active and put it under button event.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25296
Location: The netherlands

PostPosted: Sat Feb 16, 2019 2:53 am    Post subject: Reply with quote

you're not restoring the aob to the original content in the disable section

Code:

[disable]
{$lua}
if (s) then
 lngt = s.getCount()
  for x=0, lngt-1, 1 do
    writeBytes(s[x], 0x66, 0x66, 0xAE, 0x10)
 end

 s.destroy()
 s=nil
end

_________________
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
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Feb 16, 2019 3:39 am    Post subject: Reply with quote

Ah I see...thanks DB
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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