View previous topic :: View next topic |
Author |
Message |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Fri Apr 03, 2020 1:03 pm Post subject: Disable/enable ASM with hotkey? |
|
|
Hello,
So i managed to get it working when pressing F1 once, but how can i disable it when i press F1 again?
Code: | function Antibounce(sender)
UDF1.CELabel8.Font.Color = 0x00FEEC4B
autoAssemble [[
-- assemble code --
{$ASM}
]]
end
createHotkey(Antibounce, VK_F1) |
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Fri Apr 03, 2020 1:13 pm Post subject: |
|
|
use the 2nd parameter that autoAssemble returns as 2nd parameter for autoAssemble to run the [disable] script
_________________
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 |
|
 |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Fri Apr 03, 2020 1:17 pm Post subject: |
|
|
Dark Byte wrote: | use the 2nd parameter that autoAssemble returns as 2nd parameter for autoAssemble to run the [disable] script |
so how can i update the label then? but i quite didnt understand you
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25785 Location: The netherlands
|
Posted: Fri Apr 03, 2020 3:34 pm Post subject: |
|
|
something like:
Code: |
local script=[[
[enable]
-- assemble code --
{$ASM}
[disable]
-- disable code --
]]
local disableInfo
function Antibounce(sender)
if disableInfo==nil then
UDF1.CELabel8.Font.Color = 0x00FEEC4B
result, disableInfo=autoAssemble(script)
else
UDF1.CELabel8.Font.Color = 0x004BECFE
autoAssemble(script,disableInfo)
disableInfo=nil
end
end
createHotkey(Antibounce, VK_F1)
|
_________________
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 |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Fri Apr 03, 2020 4:14 pm Post subject: |
|
|
@Foxculated, maybe this will be clearer for you:
Code: | AntibounceScript = [[
[ENABLE]
//your script - enable part
[DISABLE]
//your script - disable part
]]
-- global Lua variables for this cheat: AntibounceScriptEnabled, AntibounceScriptDisableInfo
function Antibounce(sender)
local succeded
local secondReturnValue -- can have DisableInfo or errorText
if not AntibounceScriptEnabled then --script not enabled
--enable it
succeded,secondReturnValue = autoAssemble(AntibounceScript)
-- if succeded, secondReturnValue now contains DisableInfo
if succeded then
AntibounceScriptEnabled = true
AntibounceScriptDisableInfo = secondReturnValue
UDF1.CELabel8.Font.Color = 0x00FEEC4B -- cyan (cheat enabled)
end
else
--disable it
succeded,secondReturnValue = autoAssemble(AntibounceScript,AntibounceScriptDisableInfo)
if succeded then
AntibounceScriptEnabled = false
UDF1.CELabel8.Font.Color = 0 -- black (cheat disabled)
end
end
if not succeded then
UDF1.CELabel8.Font.Color = 0x000000FF -- red (script error)
showMessage('Antibounce'..'\r\n'..secondReturnValue) -- show error
end
end
if AntibounceHotkey~=nil then AntibounceHotkey.destroy() AntibounceHotkey=nil end -- just in case Lua script is executed multiple times
AntibounceHotkey = createHotkey(Antibounce, VK_F1)
|
_________________
|
|
Back to top |
|
 |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Sat Apr 04, 2020 4:45 am Post subject: |
|
|
Thanks. @Dark Byte's version worked.
|
|
Back to top |
|
 |
|