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 


Speedhack toggle

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

Joined: 12 Oct 2018
Posts: 1

PostPosted: Fri Oct 12, 2018 11:32 am    Post subject: Speedhack toggle Reply with quote

Hello im fairly new to lua however I do know a fair amount of c#. I would like to create a lua script inside of cheat engine that when a specific key is pressed the speedhack will set to a certain amount then either when the same key is pressed again or a separate key is pressed the speedhack will revert back to 1 as i understand the current hotkey for speedhack is not working correctly.
Thank you! Very Happy

_________________
Dr.Luvit
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 35

Joined: 16 Feb 2017
Posts: 1478

PostPosted: Fri Oct 12, 2018 6:38 pm    Post subject: Reply with quote

You should work carefully with this script code!
If you make a mistake, cancel the 'Print Script',
close form, open again.


Code:
if myhotkey then
  myhotkey.Destroy()
  myhotkey = nil
end
function killmytimer()
  if mytimer then
    mytimer.Destroy()
    mytimer = nil
  end
end

myhotkey = createHotkey(function()
  if mytimer then
    killmytimer()
    speedhack_setSpeed'1'
  else
    mytimer=createTimer()
    mytimer.interval=1
    mytimer.OnTimer=function()
    speedhack_setSpeed'0'
    end
  end

end, VK_F8)


or 2 Use with button: (You do not spend time with Timer)

Code:
if myhotkey then
  myhotkey.Destroy()
  myhotkey = nil
end

myhotkey = createHotkey(function()
if myhotkey then
speedhack_setSpeed'0' -- or 10 etc
end
end, VK_F8) --F8 Speed 0

myhotkey = createHotkey(function()
if myhotkey then
speedhack_setSpeed'1'
end
end, VK_F9) -- F9 Speed Normal


or speed, give manually select and command

Code:
if myhotkey then
  myhotkey.Destroy()
  myhotkey = nil
end

myhotkey = createHotkey(function()
if myhotkey then
speedhack_setSpeed(UDF1.CEEdit1.Text) --You should put a CEEdit on the table
end
end, VK_F8)

myhotkey = createHotkey(function()
if myhotkey then
speedhack_setSpeed'1'
end
end, VK_F9)

UDF1.show()


enjoy it!

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 13, 2018 4:53 am    Post subject: Reply with quote

Quote:
speedhack_setSpeed(UDF1.CEEdit1.Text) --You should put a CEEdit on the table


should be :
Code:

speedhack_setSpeed(tonumber((UDF1.CEEdit1.Text))  --You should put a CEEdit on the table


CEEdit is a TEXT must convert to number. Also if use CEEdit for speed hack amount, then considering avoid user to input 'non number' characters.

_________________
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