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 


Speed hack Script In Lua

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

Joined: 17 Jun 2022
Posts: 2

PostPosted: Sat Jun 18, 2022 8:34 am    Post subject: Speed hack Script In Lua Reply with quote

Guys, I'm setting up a Script and I would like more than one key to be done, but with separate speeds, for example, when I press Space it triggers a speed, and when I set another key it changes to another speed, I need to put it in the trainer


lastSpeed=1;

function checkKeys(timer)
if (isKeyPressed(VK_SPACE)) then
if lastspeed ~= 2.0 then
speedhack_setSpeed(2.0)
lastSpeed=2.0
end
else
if lastspeed ~= 1 then
speedhack_setSpeed(1)
lastSpeed=1
end
end

end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4289

PostPosted: Sat Jun 18, 2022 10:46 am    Post subject: Reply with quote

Search for "lua elseif"
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Jun 18, 2022 8:51 pm    Post subject: Reply with quote

Something like this :

Code:
lastSpeed=1;

function checkKeys(timer)
  if (isKeyPressed(VK_A)) then
    if lastspeed ~= 10 then
      print("speed 10")  -- speedhack_setSpeed(10)
      lastSpeed=10
    end
  elseif (isKeyPressed(VK_B)) then
      print("speed 5")  -- speedhack_setSpeed(5)
      lastSpeed=5
  elseif (isKeyPressed(VK_C)) then
      print("speed 1")  -- speedhack_setSpeed(1)
      lastSpeed=1
  end
end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Lurusha
How do I cheat?
Reputation: 0

Joined: 17 Jun 2022
Posts: 2

PostPosted: Sun Jun 19, 2022 1:16 pm    Post subject: Reply with quote

Corroder wrote:
Something like this :

Code:
lastSpeed=1;

function checkKeys(timer)
  if (isKeyPressed(VK_A)) then
    if lastspeed ~= 10 then
      print("speed 10")  -- speedhack_setSpeed(10)
      lastSpeed=10
    end
  elseif (isKeyPressed(VK_B)) then
      print("speed 5")  -- speedhack_setSpeed(5)
      lastSpeed=5
  elseif (isKeyPressed(VK_C)) then
      print("speed 1")  -- speedhack_setSpeed(1)
      lastSpeed=1
  end
end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)




It didn't work, when I press the button inside the game the speedhack doesn't work, it only opens a console with the values.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jun 19, 2022 8:28 pm    Post subject: This post has 1 review(s) Reply with quote

Balano wrote:

It didn't work, when I press the button inside the game the speedhack doesn't work, it only opens a console with the values.


Code:
lastSpeed=1;

function checkKeys(timer)
  if (isKeyPressed(VK_A)) then
    if lastspeed ~= 10 then
      speedhack_setSpeed(10)
      print("speedhack set to 10")
      lastSpeed=10
    end
  elseif (isKeyPressed(VK_B)) then
      speedhack_setSpeed(5)
      print("speedhack set to 5")
      lastSpeed=5
  elseif (isKeyPressed(VK_C)) then
      speedhack_setSpeed(1)
      print("speedhack set to 1")
      lastSpeed=1
  end
end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)


Oh, really?. It works fine for me. I think you just copy paste the script not edit it according to your needs.



SpeedHack.JPG
 Description:
 Filesize:  261.9 KB
 Viewed:  3759 Time(s)

SpeedHack.JPG



_________________
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