View previous topic :: View next topic |
Author |
Message |
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Fri Mar 23, 2018 10:19 am Post subject: Disable hotkeys in Lua |
|
|
Is it possible to disable hotkeys in lua?
I'm using this code for the hotkeys:
Code: |
--Time 1
function Reset(sender)
os.execute("time 00:31:55 & date 01/01/2017 & exit")
end
createHotkey(Reset, VK_NUMPAD1)
--Time 2
function Reset2(sender)
os.execute("time 15:47:56 & date 02/01/2017 & exit")
end
createHotkey(Reset2, VK_NUMPAD2)
--Time 3
function Reset3(sender)
os.execute("time 06:48:03 & 02/01/2017 & exit")
end
createHotkey(Reset3, VK_NUMPAD3)
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Fri Mar 23, 2018 12:18 pm Post subject: |
|
|
createHotkey returns a hotkey object that you can .destroy()
_________________
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 |
|
|
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Fri Mar 23, 2018 1:32 pm Post subject: |
|
|
Can't get it to work
Code: |
function CEButton1Click(sender)
createHotkey(Reset, VK_NUMPAD1)
createHotkey(Reset2, VK_NUMPAD2)
createHotkey(Reset3, VK_NUMPAD3)
end
function CEButton2Click(sender)
createHotkey(Reset, VK_NUMPAD1).destroy()
createHotkey(Reset2, VK_NUMPAD2).destroy()
createHotkey(Reset3, VK_NUMPAD3).destroy()
end
|
Tried using GenericHotkey.destroy(), didn't work either.
I think I may have something wrong with the second function.
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Fri Mar 23, 2018 2:10 pm Post subject: |
|
|
Johnden wrote: | Can't get it to work
Code: |
function CEButton1Click(sender)
createHotkey(Reset, VK_NUMPAD1)
createHotkey(Reset2, VK_NUMPAD2)
createHotkey(Reset3, VK_NUMPAD3)
end
function CEButton2Click(sender)
createHotkey(Reset, VK_NUMPAD1).destroy()
createHotkey(Reset2, VK_NUMPAD2).destroy()
createHotkey(Reset3, VK_NUMPAD3).destroy()
end
|
Tried using GenericHotkey.destroy(), didn't work either.
I think I may have something wrong with the second function. |
Your creating hot-keys with the first function, then creating new hot-keys and instantly destroying them with the second function.
Try some thing like this:
Code: | function CEButton1Click(sender)
Reset_HK = createHotkey(Reset, VK_NUMPAD1)
Reset2_HK = createHotkey(Reset2, VK_NUMPAD2)
Reset3_HK = createHotkey(Reset3, VK_NUMPAD3)
end
function CEButton2Click(sender)
Reset_HK.destroy()
Reset2_HK.destroy()
Reset3_HK.destroy()
end |
_________________
|
|
Back to top |
|
|
Johnden Cheater Reputation: 0
Joined: 30 Jan 2018 Posts: 25
|
Posted: Fri Mar 23, 2018 2:20 pm Post subject: |
|
|
Why didn't I think of that?
Thank you.
|
|
Back to top |
|
|
|