View previous topic :: View next topic |
Author |
Message |
SetDmg How do I cheat? Reputation: 0
Joined: 09 Dec 2013 Posts: 4
|
Posted: Thu Mar 06, 2014 3:13 am Post subject: 2 functions on push and relese button |
|
|
How to do is:
push VK_V - > 1 function
relese VK_V - > 2 function
in lua code?
I searched, but couldn't find this feature
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Thu Mar 06, 2014 6:02 am Post subject: |
|
|
that's not implemented but you can do something like this:
create a hotkey that reacts on VK_V and calls function 1
then in function 1 launch a timer that constantly checks if isKeyPressed(VK_V) is true, and if not, stop the timer and call function 2
_________________
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 |
|
|
SetDmg How do I cheat? Reputation: 0
Joined: 09 Dec 2013 Posts: 4
|
Posted: Thu Mar 06, 2014 7:30 pm Post subject: |
|
|
Here's what happened but he constantly switches the two functions, where is my mistake?
Code: |
CheatStatus = component_findComponentByName(TrainerSH, "CheatStatus")
form_show(TrainerSH)
control_setCaption(TrainerSH, "Trainer [Not Included]")
autoAttachList = getAutoAttachList()
stringlist_add(autoAttachList, "Game.exe")
function SpeedDef()
control_setCaption(CheatStatus, "Speed Default")
speedValue = "1"
end
function SpeedLow()
control_setCaption(CheatStatus, "Speed Low")
SpeedValue = "1.5"
end
function Speedx2()
control_setCaption(CheatStatus, "Speed x2")
SpeedValue = "2"
end
--Push/Release Button
function EnableSpeed()
control_setCaption(CheatStatus, "Speed Enabled")
speedhack_setSpeed(SpeedValue)
CheckPressTimer = createTimer(trainerForm)
timer_setInterval(CheckPressTimer, 100)
timer_onTimer(CheckPressTimer, CheckPress)
end
function CheckPress()
if isKeyPressed(VK_SHIFT) then
SpeedDef()
return false
end
end
--push/Release Button
function OnCheckHotkeys()
if isKeyPressed(VK_F2) then
SpeedLow()
return
end
if isKeyPressed(VK_F3) then
Speedx2()
return
end
end
function onOpenProcess(processid)
control_setCaption(TrainerSH, "Trainer [Included]")
hotKeyTimer = createTimer(trainerForm)
timer_setInterval(hotKeyTimer, 100)
timer_onTimer(hotKeyTimer, OnCheckHotkeys)
createHotkey(EnableSpeed, VK_SHIFT)
end
function FromClose(sender)
closeCE()
return caFree
end
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25295 Location: The netherlands
|
Posted: Fri Mar 07, 2014 3:50 pm Post subject: |
|
|
get rid of the createHotkey. It gets called every few milliseconds.
Use the hotkeyTimer instead (or destroy the EnableSpeed hotkey)
In OnCheckHotkeys check if VK_SHIFT is down and if so, activate the speedhack if it isn't already active and set a flag indicating that the speedhack is active. (And don't check if that flag is true)
In OnCheckHotkeys also check if VK_SHIFT is NOT down. And if so deactivate the speedhack if it is active.
_________________
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 |
|
|
|