Posted: Sat Aug 10, 2024 3:07 pm Post subject: Putting pointers in a script
I'm trying to do a script that changes a value to 0 and freeze it when the script is enabled and that changes to 1 when script is diasbled.
Here is my script:
Code:
[ENABLE]
{$lua}
-- Function to check and set the value to 0 if it equals 1
function checkValue()
local value = readInteger(0x28C106A5F60)
print("Current Value: ", value) -- Debugging output to see the current value
if value == 1 then
print("Changing value to 0") -- Debugging output to confirm the change is being attempted
writeInteger(0x28C106A5F60, 0)
end
end
-- Create a timer that checks the value every 50ms
valTimer = createTimer(MainForm, false)
valTimer.Interval = 50 -- Set interval to 50ms
valTimer.OnTimer = checkValue
valTimer.Enabled = true
{$asm}
[DISABLE]
{$lua}
-- Disable the timer created during the enable phase
if valTimer ~= nil then
valTimer.Enabled = false
valTimer.destroy()
valTimer = nil
end
-- Optionally, reset the value to 1 when the cheat is disabled
writeInteger(0x28C106A5F60, 1)
{$asm}
It works well but i want to make it work by using pointers not a simple address.
Has any of you an idea of how I could do that ?
Note: It's my first time here so sorry if i dont explain smth very well.
if valTimer then
valTimer.destroy()
valTimer = nil
end
[ENABLE]
valTimer = createTimer(MainForm)
valTimer.Interval = 50
valTimer.OnTimer = function(t)
local addr = getAddressSafe'[[game.exe+1234]+5C]+8'
if not addr then return end -- pointer path not valid
if readInteger(addr) == 1 then
writeInteger(addr, 0)
end
end
[DISABLE]
local addr = getAddressSafe'[[game.exe+1234]+5C]+8'
if addr then
writeInteger(addr, 1)
end
_________________
I don't know where I'm going, but I'll figure it out when I get there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum