| View previous topic :: View next topic |
| Author |
Message |
Sk4terd How do I cheat?
Reputation: 0
Joined: 05 Nov 2016 Posts: 3 Location: Dust ll
|
Posted: Sat Nov 05, 2016 11:02 pm Post subject: How would I add a value? |
|
|
I get an Error for XP on line 7 and I don't know why. I'm not the smartest when it comes to lua though, I also got the base code from somewhere else on this forum.
I am wanting it to give xp while the script is toggled on.
| Code: | timer = createTimer(nil, true)
timer_setInterval(timer, 100)
function XP_Spam()
if (getOpenedProcessID() ~= 0) then
local XP = readInteger('[[[[["Borderlands2.exe"+01EEE798]+6c]+1a8]+668]+19c]+2c')
local AddedXP = XP + 1000
writeInteger('[[[[["Borderlands2.exe"+01EEE798]+6c]+1a8]+668]+19c]+2c', AddedXP)
end
end
timer_onTimer(timer, XP_Spam) |
|
|
| Back to top |
|
 |
usernotfound Expert Cheater
Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Sun Nov 06, 2016 2:28 am Post subject: |
|
|
What does your error message say? (it should specify that something is expected on line 7)
Seems fine to me, I executed your script as it is & no errors were thrown.
|
|
| Back to top |
|
 |
Sk4terd How do I cheat?
Reputation: 0
Joined: 05 Nov 2016 Posts: 3 Location: Dust ll
|
Posted: Sun Nov 06, 2016 2:44 am Post subject: |
|
|
Error:[string " timer = createTimer(nil, true)
..."]:7: attempt to perform arithmetic on a nil value (local 'XP')
|
|
| Back to top |
|
 |
panraven Grandmaster Cheater
Reputation: 62
Joined: 01 Oct 2008 Posts: 959
|
Posted: Sun Nov 06, 2016 4:58 am Post subject: |
|
|
readInteger will return a number if the address is readable, but return nothing when the address is not readable, setting a variable (XP) with nothing will set it as nil.
nil in Lua is not a number, and cannot make arithmetic with other number, so the error.
Try check if the pointer address is valid.
To handle the error in the OnTimer function, try like:
| Code: |
function XP_Spam()
if (getOpenedProcessID() ~= 0) then
local addr = '[[[[["Borderlands2.exe"+01EEE798]+6c]+1a8]+668]+19c]+2c'
local XP = readInteger(addr)
if XP~=nil then
local AddedXP = XP + 1000
writeInteger(addr, AddedXP)
GetMainForm().Caption = "xp now:"..AddedXP
else
GetMainForm().Caption = addr..' Not Readable' -- not print, may be some other ui
end
end
end
|
bye~
_________________
- Retarded. |
|
| Back to top |
|
 |
Sk4terd How do I cheat?
Reputation: 0
Joined: 05 Nov 2016 Posts: 3 Location: Dust ll
|
Posted: Sun Nov 06, 2016 1:43 pm Post subject: |
|
|
I put the offsets in backwards, I didn't know that was a thing, sorry.
Thanks for the code though, it helps.
| Code: | timer = createTimer(nil, true)
timer_setInterval(timer, 1)
function XP_Spam()
if (getOpenedProcessID() ~= 0) then
local addr = '[[[[["Borderlands2.exe"+01EEE798]+2c]+19c]+668]+1a8]+6c'
local XP = readInteger(addr)
if XP~=nil then
local AddedXP = XP + 250
writeInteger(addr, AddedXP)
GetMainForm().Caption = "xp now:"..AddedXP
else
GetMainForm().Caption = addr..' Not Readable' -- not print, may be some other ui
end
end
end
timer_onTimer(timer, XP_Spam) |
|
|
| Back to top |
|
 |
|