| View previous topic :: View next topic |
| Author |
Message |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Sat Aug 21, 2021 5:11 am Post subject: Toggle-able function |
|
|
I wanna to know how to make toggle able function
i'm using this code: | Code: | function godmode(enabled)
if enabled == 1 then
--Do some code
end
end |
To make function with enable/disable section[/code] |
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Sat Aug 21, 2021 5:21 am Post subject: |
|
|
| Code: |
function toggle(addressDescription)
local al = getAddressList()
local mr = al.getMemoryRecordByDescription(addressDescription)
mr.Active = not mr.Active
end
toggle('Toggle Script')
|
|
|
| Back to top |
|
 |
Frouk Grandmaster Cheater
Reputation: 5
Joined: 22 Jun 2021 Posts: 510
|
Posted: Sat Aug 21, 2021 5:51 am Post subject: |
|
|
| LeFiXER wrote: | | Code: |
function toggle(addressDescription)
local al = getAddressList()
local mr = al.getMemoryRecordByDescription(addressDescription)
mr.Active = not mr.Active
end
toggle('Toggle Script')
|
|
Like this: | Code: | function freezeTimer()
if toggle then
writeBytes(0x123456,1)
end
if not toggle then
writeBytes(0x123456,0)
end
end |
To call function twice and toggle cheat
| Code: | freezeTimer() --Enabled
freezeTimer() --Disabled
|
EDIT:
| Code: | function toggleDead(toggle)
if toggle then
toggle = true
writeBytes('PlayerPTR+74',1)
end
if not toggle then
toggle = false
writeBytes('PlayerPTR+74',0)
end
end
toggleDead(true) --Will toggle dead to 1
toggleDead(false) --Will toggle dead to 0 |
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Sat Aug 21, 2021 5:58 am Post subject: |
|
|
I don't think you explicity require a propietary function for this since you can just check if the memory record is active or not. Unless, you're trying to read a value of an address and base the activation on that addresses value; in which case you would do something like this:
| Code: |
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('address description')
if mr ~= nil then
if mr.value == 'value' then
writeBytes(0x123456,1)
else
writeBytes(0x123456,0)
end
end
|
If you want to constantly check the value then you will have to do one of two things, use a timer or use the createThread function. |
|
| Back to top |
|
 |
|