View previous topic :: View next topic |
Author |
Message |
danishdanish Newbie cheater Reputation: 0
Joined: 15 Mar 2016 Posts: 23
|
Posted: Mon Nov 08, 2021 4:52 am Post subject: Help LUA REGENERATION CODE |
|
|
Hello everyone.
First of all I don't know a bit about programming and I needed a code that would generate suns every second in Plants vs zombie game only when the value is under 100, so i asked somebody and he wrote me this code below.
DoneState = false
local addr = 0x10940148
local val = 1
local function timer_tick(timer)
local v = readInteger(addr) -- read value
if v < 100 then -- check value
writeInteger(addr, val + v) -- write value
else
DoneState = true -- this stops the timer, if value if > 100
end
if DoneState == true then
timer.destroy()
end
end
if syntaxcheck then return end
local someTimer = createTimer(MainForm)
someTimer.Interval = 1000
someTimer.OnTimer = timer_tick
The code was working long time ago. It was more than 2 years ago. and Ive emailed this code to myself.
Today I wanted to play the game with this same script but this isn't seem to be working now.
Any help would be greatly appreciated.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Mon Nov 08, 2021 5:03 am Post subject: |
|
|
Firstly, use code tags when submitting code [ code ] ... [ /code ] (without spaces). Secondly, the address here; local addr = 0x10940148 will have changed and that's the reason why it's no longer working. Also you will want to assign nil to the timer.
Code: |
if DoneState then -- "== true isn't required here"
timer.destroy()
timer = nil
end
|
|
|
Back to top |
|
|
danishdanish Newbie cheater Reputation: 0
Joined: 15 Mar 2016 Posts: 23
|
Posted: Fri Nov 12, 2021 7:33 am Post subject: |
|
|
My address is correct. The code is not working.
Anyone else can help me out ? Please .
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Fri Nov 12, 2021 10:06 am Post subject: Re: Help LUA REGENERATION CODE |
|
|
danishdanish wrote: |
The code was working long time ago. It was more than 2 years ago. and Ive emailed this code to myself.
Today I wanted to play the game with this same script but this isn't seem to be working now.
Any help would be greatly appreciated. |
The game will no doubtedly have received updates and therefore the address that holds the value you want to manipulate will have changed also. Having taken a look, this code works absolutely fine without issue. (I can't say for the address but the code works fine).
Code: |
{$LUA}
if syntaxcheck then return end
{$ASM}
[ENABLE]
{LUA}
local DoneState = false
local addr = 0x10940148
local val = 1
local t = createTimer(getMainForm())
t.Interval = 1000
t.OnTimer = function()
local v = readInteger(addr) -- read value
if v < 100 then -- check value
writeInteger(addr, val + v) -- write value
else
print('Timer finished')
DoneState = true -- this stops the timer, if value if > 100
end
if DoneState then
print('Timer destroyed')
t.destroy()
t = nil
end
end
{$ASM}
[DISABLE]
{$LUA}
if t then
t.destroy()
t = nil
end
|
|
|
Back to top |
|
|
danishdanish Newbie cheater Reputation: 0
Joined: 15 Mar 2016 Posts: 23
|
Posted: Sun Nov 14, 2021 1:22 am Post subject: |
|
|
Figured out. The problem was with this line
"print('Timer finished')
DoneState = true -- this stops the timer, if value if > 100"
I comment it out and the code is now working fine.
Anyways Thanks For your time. I greatly appreciate.
|
|
Back to top |
|
|
LeFiXER Grandmaster Cheater Supreme Reputation: 20
Joined: 02 Sep 2011 Posts: 1053 Location: 0x90
|
Posted: Sun Nov 14, 2021 11:42 am Post subject: |
|
|
danishdanish wrote: | Figured out. The problem was with this line
"print('Timer finished')
DoneState = true -- this stops the timer, if value if > 100"
I comment it out and the code is now working fine.
Anyways Thanks For your time. I greatly appreciate. |
The code was working fine even with that line uncommented. I know because I tested it.
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
|
Back to top |
|
|
Frouk Master Cheater Reputation: 5
Joined: 22 Jun 2021 Posts: 489 Location: mov dword ptr [Ukraine]
|
Posted: Wed Nov 17, 2021 1:35 am Post subject: |
|
|
Code: | {$lua}
[ENABLE]
--DoneState = false --First of all we don't need that
local addr = 0x10940148
local val = 1
local t = createTimer(nil)
t.Interval = 1000
t.OnTimer = function()
local v = readInteger(addr)
if v >= 100 then
return --Forcing to return if v is bigger or equals 100 e.g. do not write value
end
writeInteger(addr,v + val)
end
[DISABLE]
t.destroy()
t = nil
{$asm}
|
I haven't checked the code yet, but maybe it might be working
_________________
void(__cdecl *Haxing)(HWND hGameWindow) |
|
Back to top |
|
|
|