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 


show message "hack failed to enable" in lua

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

Joined: 22 Jan 2018
Posts: 4

PostPosted: Mon Jan 22, 2018 5:21 pm    Post subject: show message "hack failed to enable" in lua Reply with quote

Hi, i wanted to ask how can I show message as "Hack Failed to Enable" in lua while toggling assemble from addresslist.

for example the toggling script is this:
i = 0
addresslist=getAddressList()
memrec=addresslist_getMemoryRecordByDescription(addresslist, testing)

if( i == 0 ) then

--ENABLE CHEAT SCRIPT

memoryrecord_freeze(memrec)
showMessage("ENABLED")
end

i = (i +1)%2

return true

now how can I make it show "Hack Failed to Enable" if it is not toggled.
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Mon Jan 22, 2018 5:46 pm    Post subject: Reply with quote

Is this in a memory record script or the table Lua script?

And is there a reason for using an integer to enable and disable the script (and not a boolean), because the first time it enable, then disable, then disable, then enable, and enabled again.

Example:
Code:
for i = 0, 20 do
    i = (i +1)%2
    print(i)
end

And running this will output this:
Quote:
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

_________________


Last edited by TheyCallMeTim13 on Mon Jan 22, 2018 5:47 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Mon Jan 22, 2018 5:47 pm    Post subject: Reply with quote

something like this:
Code:

memrec.Active=true
if (memrec.Active==false) then
  showMessage('Hack Failed to Enable')
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
darkgames
How do I cheat?
Reputation: 0

Joined: 22 Jan 2018
Posts: 4

PostPosted: Mon Jan 22, 2018 6:29 pm    Post subject: Reply with quote

Thanks Tim and DarkByte helped me a lot. Smile

It worked this way, the code is below maybe if others are looking for this function.

Code:
memrec.Active=true
if (memrec.Active==true) then
  showMessage('Hack Enabled')
end
if (memrec.Active==false) then
  showMessage('Hack Failed to Enable')
end
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