View previous topic :: View next topic |
Author |
Message |
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Mon May 14, 2018 2:43 am Post subject: How to check Value in lua ? |
|
|
My idea is like this :
Is there a way to turn on trainer
I will click button it will check value = 0 trainer will turn on
if value is not correct = 0 trainer will turn off
How do I do this?
|
|
Back to top |
|
|
Profound_Darkness Newbie cheater Reputation: 0
Joined: 21 May 2015 Posts: 23
|
Posted: Mon May 14, 2018 4:10 pm Post subject: |
|
|
Hmm... I remember reading something a while ago about a self activating/deactivating cheat...
Managed to find the thread but it's a bit long and bounces around what you are interested in so I'll share what I distilled out of it for myself with a twist towards what you seem to want. This is a bit of a skeleton.
In a cheat table script
Code: |
[Enable]
{$Lua}
function checkValue(sender)
local value
--Code to get the value that is to be tested.
if value ~= 0 then
getAddressList().getMemoryRecordByID(31).Active = false
--You need to get the ID of the script and replace the 31 with that ID.
end
end
local value
--code to get 'value'
if value ~= 0 then return 0 end --if the value is not 0 don't enable this cheat
--Any other lua code you might have if this cheat is enabled.
--Since there could be other elements that cause the cheat to bail in Lua I've put the timer code down here.
watchTimer = createTimer(nil)
watchTimer.OnTimer=checkValue
watchTimer.interval=100
watchTimer.Enabled = true
{$asm}
//any asm code you might have if the cheat is enabled.
[Disable]
{$Lua}
watchTimer.Enabled = false --this line probably unnecessary.
watchTimer.destroy()
--Any other Lua disable code...
{$asm}
//any asm code for disabling the cheat.
|
Regarding getting the ID. One way to do this is to open the cheat table file in a text editor, search for the name of the script (helps if it's unique), and the ID is right there above the description (what you searched for). Another is to have some temporary lua code which will iterate over each item in the list and print it's name and ID out... Leaving that as an exercise.
|
|
Back to top |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Mon May 14, 2018 6:12 pm Post subject: |
|
|
Profound_Darkness wrote: | Hmm... I remember reading something a while ago about a self activating/deactivating cheat...
Managed to find the thread but it's a bit long and bounces around what you are interested in so I'll share what I distilled out of it for myself with a twist towards what you seem to want. This is a bit of a skeleton.
In a cheat table script
Code: |
[Enable]
{$Lua}
function checkValue(sender)
local value
--Code to get the value that is to be tested.
if value ~= 0 then
getAddressList().getMemoryRecordByID(31).Active = false
--You need to get the ID of the script and replace the 31 with that ID.
end
end
local value
--code to get 'value'
if value ~= 0 then return 0 end --if the value is not 0 don't enable this cheat
--Any other lua code you might have if this cheat is enabled.
--Since there could be other elements that cause the cheat to bail in Lua I've put the timer code down here.
watchTimer = createTimer(nil)
watchTimer.OnTimer=checkValue
watchTimer.interval=100
watchTimer.Enabled = true
{$asm}
//any asm code you might have if the cheat is enabled.
[Disable]
{$Lua}
watchTimer.Enabled = false --this line probably unnecessary.
watchTimer.destroy()
--Any other Lua disable code...
{$asm}
//any asm code for disabling the cheat.
|
Regarding getting the ID. One way to do this is to open the cheat table file in a text editor, search for the name of the script (helps if it's unique), and the ID is right there above the description (what you searched for). Another is to have some temporary lua code which will iterate over each item in the list and print it's name and ID out... Leaving that as an exercise. |
Thanks you , working
|
|
Back to top |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Tue May 15, 2018 3:10 am Post subject: |
|
|
Profound_Darkness wrote: | Hmm... I remember reading something a while ago about a self activating/deactivating cheat...
Managed to find the thread but it's a bit long and bounces around what you are interested in so I'll share what I distilled out of it for myself with a twist towards what you seem to want. This is a bit of a skeleton.
In a cheat table script
Code: |
[Enable]
{$Lua}
function checkValue(sender)
local value
--Code to get the value that is to be tested.
if value ~= 0 then
getAddressList().getMemoryRecordByID(31).Active = false
--You need to get the ID of the script and replace the 31 with that ID.
end
end
local value
--code to get 'value'
if value ~= 0 then return 0 end --if the value is not 0 don't enable this cheat
--Any other lua code you might have if this cheat is enabled.
--Since there could be other elements that cause the cheat to bail in Lua I've put the timer code down here.
watchTimer = createTimer(nil)
watchTimer.OnTimer=checkValue
watchTimer.interval=100
watchTimer.Enabled = true
{$asm}
//any asm code you might have if the cheat is enabled.
[Disable]
{$Lua}
watchTimer.Enabled = false --this line probably unnecessary.
watchTimer.destroy()
--Any other Lua disable code...
{$asm}
//any asm code for disabling the cheat.
|
Regarding getting the ID. One way to do this is to open the cheat table file in a text editor, search for the name of the script (helps if it's unique), and the ID is right there above the description (what you searched for). Another is to have some temporary lua code which will iterate over each item in the list and print it's name and ID out... Leaving that as an exercise. |
It looks like it does not work as expected
Can you be clearer?
|
|
Back to top |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Wed May 16, 2018 10:09 am Post subject: |
|
|
Help me please
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Wed May 16, 2018 6:03 pm Post subject: |
|
|
Code: | function CheckValue(t)
local al=getAddressList()
local memrec=al.getMemoryRecordByDescription("ok")
if memrec~=nil then
memrec.Active = true
if tonumber(memrec.Value) ~= 0 then
showMessage("ERROR")
closeCE()
return caFree
end
end
end
function ActivateTimer()
t=createTimer(nil)
t.OnTimer=CheckValue
t.Interval=1000 --every 1 second
t.Enabled=true
end |
and add an aa script with this code:
Code: | [enable]
luacall(ActivateTimer())
[disable]
luacall(t.destroy()) |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Last edited by Corroder on Thu May 17, 2018 5:51 am; edited 1 time in total |
|
Back to top |
|
|
Sting9x Expert Cheater Reputation: 0
Joined: 27 Jul 2016 Posts: 124
|
Posted: Thu May 17, 2018 3:36 am Post subject: |
|
|
Corroder wrote: | Code: | function CheckValue(t)
local al=getAddressList()
local memrec=al.getMemoryRecordByDescription("ok")
if memrec~=nil then
memrec.Active = true
if tonumber(memrec.Value) ~= 0 then
showMessage("ERROR")
closeCE()
return caFree
end
end
end
function ActivateTimer()
t=createTimer(nil)
t.OnTimer=CheckHealth
t.Interval=1000 --every 1 second
t.Enabled=true
end |
and add an aa script with this code:
Code: | [enable]
luacall(ActivateTimer())
[disable]
luacall(t.destroy()) |
|
Tks u , working , you are great
|
|
Back to top |
|
|
|