Jump to content
Sign in to follow this  
GLSGmc

How do you edit a specific memory addresses value via a lua script

Recommended Posts

The memory address is #BEBCB204

Share this post


Link to post
Share on other sites

Do I need to add the gg.searchNumber()?

 

Thanks for the reply ?

Share this post


Link to post
Share on other sites
15 minutes ago, GLSGmc said:

Do I need to add the gg.searchNumber()?

It depends on what you want to achieve.
If you know the address of the value and want to modify it, then only setValues function is needed. But in most cases this won't be enough, because the desired value will change it's address after restarting the game.

Edited by CmP

Share this post


Link to post
Share on other sites

function AIMBOT ()

gg.clearResults()
gg.toast('Loading Aimbot')
gg.clearResults()
gg.searchNumber("1.91249990463F",gg.TYPE_DOUBLE,false,gg.SIGN_FUZZY_EQUAL,0,-1)
gg.searchNumber("1.91249990463",gg.TYPE_FLOAT,false,gg.SIGN_FUZZY_EQUAL,0,-1)
var = gg.getResults(10)
gg.editAll("999999",gg.TYPE_FLOAT)
gg.clearResults()
gg.clearResults()
gg.toast('Aimbot Enabled')
gg.clearResults()
end

 

 

Lets say I want to edit an specific result from the list (10) without changing the other ones... I ask this because the game I am doing this for has a glitch when i change all 10. The glitch is that when i try  to shoot the game freezes and i have to restart the app so value is in one of the 10 but I only need to edit 1 which is the 4th result.

Edited by GLSGmc

Share this post


Link to post
Share on other sites

I have a solution for you, but let's review your code first.

1) There are many redundant calls to clearResults function. Consecutive applying of this function is completely useless.

51 minutes ago, GLSGmc said:

gg.editAll("999999",gg.TYPE_FLOAT)
gg.clearResults()
gg.clearResults()
gg.toast('Aimbot Enabled')

51 minutes ago, GLSGmc said:

gg.clearResults()
gg.toast('Loading Aimbot')
gg.clearResults()

2) One redundant call to searchNumber function. And why would you specify "gg.TYPE_DOUBLE" in the first search, if you are searching for ONE FLOAT value according to the search string? These calls have same effect: GG performs a search for value "1.91249990463" of float type.

51 minutes ago, GLSGmc said:

gg.searchNumber("1.91249990463F",gg.TYPE_DOUBLE,false,gg.SIGN_FUZZY_EQUAL,0,-1)
gg.searchNumber("1.91249990463",gg.TYPE_FLOAT,false,gg.SIGN_FUZZY_EQUAL,0,-1)

Here is the example of how your function could be rewritten to fix the above-mentioned redundancies and to add the ability to modify only required results leaving others untouched:

function AIMBOT ()
  gg.toast('Loading Aimbot')
  gg.clearResults()
  gg.searchNumber("1.91249990463", gg.TYPE_FLOAT)
  local results = gg.getResults(10)
  local targetResultsNumbers = {2, 5, 8} -- table with numbers of results to modify, other results won`t be touched
  local elementsToModify = {}
  for i, v in ipairs(targetResultsNumbers) do
    if results[v] ~= nil then
      table.insert(elementsToModify, {address = results[v].address; flags = results[v].flags; value = '999999'})
    end
  end
  if #elementsToModify > 0 then
    gg.setValues(elementsToModify)
  end
  gg.clearResults()
  gg.toast('Aimbot Enabled')
end


 

Edited by CmP

Share this post


Link to post
Share on other sites
Vào ngày 23/7/2018 lúc 09:52, saiaapiz nói:

 

Is there any way to fix a value without searchNumber?

 

Edited by Tis-VN
Misspell

Share this post


Link to post
Share on other sites
15 hours ago, CmP said:

I have a solution for you, but let's review your code first.

1) There are many redundant calls to clearResults function. Consecutive applying of this function is completely useless.

2) One redundant call to searchNumber function. And why would you specify "gg.TYPE_DOUBLE" in the first search, if you are searching for ONE FLOAT value according to the search string? These calls have same effect: GG performs a search for value "1.91249990463" of float type.

Here is the example of how your function could be rewritten to fix the above-mentioned redundancies and to add the ability to modify only required results leaving others untouched:


function AIMBOT ()
  gg.toast('Loading Aimbot')
  gg.clearResults()
  gg.searchNumber("1.91249990463", gg.TYPE_FLOAT)
  local results = gg.getResults(10)
  local targetResultsNumbers = {2, 5, 8} -- table with numbers of results to modify, other results won`t be touched
  local elementsToModify = {}
  for i, v in ipairs(targetResultsNumbers) do
    if results[v] ~= nil then
      table.insert(elementsToModify, {address = results[v].address; flags = results[v].flags; value = '999999'})
    end
  end
  if #elementsToModify > 0 then
    gg.setValues(elementsToModify)
  end
  gg.clearResults()
  gg.toast('Aimbot Enabled')
end


 

So does this mean it would only effect search values 2,5 and 8? And if so is there a possibility that the search numbers change if there is no game/server updates? Because this was working fine before but after like a week the whole search had more results and the one I needed was mixed in the 10 results where before it used to be just 2

Share this post


Link to post
Share on other sites
19 hours ago, CmP said:

I have a solution for you, but let's review your code first.

1) There are many redundant calls to clearResults function. Consecutive applying of this function is completely useless.

2) One redundant call to searchNumber function. And why would you specify "gg.TYPE_DOUBLE" in the first search, if you are searching for ONE FLOAT value according to the search string? These calls have same effect: GG performs a search for value "1.91249990463" of float type.

Here is the example of how your function could be rewritten to fix the above-mentioned redundancies and to add the ability to modify only required results leaving others untouched:


function AIMBOT ()
  gg.toast('Loading Aimbot')
  gg.clearResults()
  gg.searchNumber("1.91249990463", gg.TYPE_FLOAT)
  local results = gg.getResults(10)
  local targetResultsNumbers = {2, 5, 8} -- table with numbers of results to modify, other results won`t be touched
  local elementsToModify = {}
  for i, v in ipairs(targetResultsNumbers) do
    if results[v] ~= nil then
      table.insert(elementsToModify, {address = results[v].address; flags = results[v].flags; value = '999999'})
    end
  end
  if #elementsToModify > 0 then
    gg.setValues(elementsToModify)
  end
  gg.clearResults()
  gg.toast('Aimbot Enabled')
end


I also seem to be having this error when I add that code

Script ended:
Script error: org.luaj.vm2.LuaError: load /storage/emulated/0/360/CC/Beta.lua: org.luaj.vm2.LuaError: /storage/emulated/0/360/CC/Beta.lua:187
`function AIMBOT ()`
'<name>' expected near ï
    at org.luaj.vm2.LuaValue.error(LuaValue.java:1075)
    at org.luaj.vm2.Globals.loadfile(Globals.java:208)
    at android.ext.Script.runScript(Script.java:3792)
    at android.ext.Script$ScriptThread.run(Script.java:3645)
Caused by: org.luaj.vm2.LuaError: /storage/emulated/0/360/Creative-Destruction/Beta.lua:187
`function AIMBOT ()`
'<name>' expected near ï
    at org.luaj.vm2.compiler.LexState.lexerror(LexState.java:277)
    at org.luaj.vm2.compiler.LexState.syntaxerror(LexState.java:281)
    at org.luaj.vm2.compiler.LexState.error_expected(LexState.java:842)
    at org.luaj.vm2.compiler.LexState.check(LexState.java:855)
    at org.luaj.vm2.compiler.LexState.str_checkname(LexState.java:883)
    at org.luaj.vm2.compiler.LexState.singlevar(LexState.java:935)
    at org.luaj.vm2.compiler.LexState.funcname(LexState.java:1998)
    at org.luaj.vm2.compiler.LexState.funcstat(LexState.java:2015)
    at org.luaj.vm2.compiler.LexState.statement(LexState.java:2099)
    at org.luaj.vm2.compiler.LexState.statlist(LexState.java:2143)
    at org.luaj.vm2.compiler.LexState.mainfunc(LexState.java:2159)
    at org.luaj.vm2.compiler.LuaC$CompileState.luaY_parser(LuaC.java:129)
    at org.luaj.vm2.compiler.LuaC.compile(LuaC.java:99)
    at org.luaj.vm2.Globals.compilePrototype(Globals.java:327)
    at org.luaj.vm2.Globals.loadPrototype(Globals.java:306)
    at org.luaj.vm2.Globals.load(Globals.java:277)
    at org.luaj.vm2.Globals.loadfile(Globals.java:202)
    ... 2 more

 

 

 

 

Then I added an F to specify what the search was and got this

Script ended:
Script error: org.luaj.vm2.LuaError: load /storage/emulated/0/360/CC/Beta.lua: org.luaj.vm2.LuaError: /storage/emulated/0/360/CC/Beta.lua:194
`  for i, v in ipairs(targetResultsNumbers) do`
unexpected symbol near ï
    at org.luaj.vm2.LuaValue.error(LuaValue.java:1075)
    at org.luaj.vm2.Globals.loadfile(Globals.java:208)
    at android.ext.Script.runScript(Script.java:3792)
    at android.ext.Script$ScriptThread.run(Script.java:3645)
Caused by: org.luaj.vm2.LuaError: /storage/emulated/0/360/CC/Beta.lua:194
`  for i, v in ipairs(targetResultsNumbers) do`
unexpected symbol near ï
    at org.luaj.vm2.compiler.LexState.lexerror(LexState.java:277)
    at org.luaj.vm2.compiler.LexState.syntaxerror(LexState.java:281)
    at org.luaj.vm2.compiler.LexState.primaryexp(LexState.java:1390)
    at org.luaj.vm2.compiler.LexState.suffixedexp(LexState.java:1401)
    at org.luaj.vm2.compiler.LexState.simpleexp(LexState.java:1481)
    at org.luaj.vm2.compiler.LexState.subexpr(LexState.java:1594)
    at org.luaj.vm2.compiler.LexState.expr(LexState.java:1612)
    at org.luaj.vm2.compiler.LexState.explist(LexState.java:1312)
    at org.luaj.vm2.compiler.LexState.funcargs(LexState.java:1332)
    at org.luaj.vm2.compiler.LexState.suffixedexp(LexState.java:1427)
    at org.luaj.vm2.compiler.LexState.simpleexp(LexState.java:1481)
    at org.luaj.vm2.compiler.LexState.subexpr(LexState.java:1594)
    at org.luaj.vm2.compiler.LexState.expr(LexState.java:1612)
    at org.luaj.vm2.compiler.LexState.explist(LexState.java:1312)
    at org.luaj.vm2.compiler.LexState.forlist(LexState.java:1891)
    at org.luaj.vm2.compiler.LexState.forstat(LexState.java:1911)
    at org.luaj.vm2.compiler.LexState.statement(LexState.java:2091)
    at org.luaj.vm2.compiler.LexState.statlist(LexState.java:2143)
    at org.luaj.vm2.compiler.LexState.body(LexState.java:1302)
    at org.luaj.vm2.compiler.LexState.funcstat(LexState.java:2016)
    at org.luaj.vm2.compiler.LexState.statement(LexState.java:2099)
    at org.luaj.vm2.compiler.LexState.statlist(LexState.java:2143)
    at org.luaj.vm2.compiler.LexState.mainfunc(LexState.java:2159)
    at org.luaj.vm2.compiler.LuaC$CompileState.luaY_parser(LuaC.java:129)
    at org.luaj.vm2.compiler.LuaC.compile(LuaC.java:99)
    at org.luaj.vm2.Globals.compilePrototype(Globals.java:327)
    at org.luaj.vm2.Globals.loadPrototype(Globals.java:306)
    at org.luaj.vm2.Globals.load(Globals.java:277)
    at org.luaj.vm2.Globals.loadfile(Globals.java:202)
    ... 2 more

Edited by GLSGmc

Share this post


Link to post
Share on other sites
27 minutes ago, GLSGmc said:

'<name>' expected near ï

27 minutes ago, GLSGmc said:

unexpected symbol near ï

These symbols probably appear when the code is being copied from forum. Retyping the line where an error occured most likely will help.

File with the function and a call to it (run from GG to test, if it works):
aimbot_function.lua

31 minutes ago, GLSGmc said:

Then I added an F to specify what the search was and got this

You don't need to do this. If it's group search and you need to search for values of different types, then you specify the type after the value. Otherwise, you don't. In your case, there is only 1 value, type of the search is "gg.TYPE_FLOAT", meaning that float value will be searched.
Example, where specifying the type is needed:
Objective — search for double value 4.32, followed by dword value 7274, followed by byte value 87 with group size equal to 14.
Search string —  "4.32E; 7274D; 87B::14".

Share this post


Link to post
Share on other sites

Thanks for the help ?

Share this post


Link to post
Share on other sites

CmP what if the number of results change? Everytime I restart the app?

Edited by GLSGmc

Share this post


Link to post
Share on other sites
1 hour ago, GLSGmc said:

CmP what if the number of results change? Everytime I restart the app?

Moreover, the number WILL change (in most cases). You can't rely on it and of course not on the index number of the desired element in results list.

Find other way of searching for required value. Maybe look for patterns before/after the value in memory editor, also check nearby pointers and pointers to the addresses that are close to the address of your value.

Share this post


Link to post
Share on other sites
44 minutes ago, CmP said:

Moreover, the number WILL change (in most cases). You can't rely on it and of course not on the index number of the desired element in results list.

Find other way of searching for required value. Maybe look for patterns before/after the value in memory editor, also check nearby pointers and pointers to the addresses that are close to the address of your value.

Yeah what I found is that the value I'm looking for is usually 7 numbers down. So if there are 269 results the 262 result is the value I want to change but like I mentioned the number of results change

Share this post


Link to post
Share on other sites

 

try using the api gg.searchaddress...

 

I use my functions so with the search address:

ex:

function ESP_DES()
    gg.setRanges(gg.REGION_CODE_APP)
    gg.searchAddress ( '9A8CC17C' , 0xFFFFFFFF, gg . TYPE_FLOAT , gg . SIGN_EQUAL , 0x90000000, 0x9FFFFFFF) 
    gg.searchNumber('500' , gg . TYPE_FLOAT )
    gg.getResults(10)
    gg.editAll('-2', gg.TYPE_FLOAT , gg.SIGN_EQUAL , 0 , -1)
    gg.clearResults()

    gg.toast('? ESP Desativado? Aí sim meu patrão! kkk ? ')

end

--or

--"????" is random and changes each time the application starts

  [...]  gg.searchAddress ( '9????17C' , 0xFFFFFFFF, gg . TYPE_FLOAT , gg . SIGN_EQUAL , 0,  -1)
   gg.searchNumber('75' , gg . TYPE_FLOAT )
   gg.getResults(10)
    gg.editAll('-2', gg.TYPE_FLOAT , gg.SIGN_EQUAL , 0 , -1)
    gg.clearResults()   
    gg.toast('? ESP Desativado? Aí sim meu patrão! kkk ? ')
  end

 

I hope you understood

and sorry my bad english :V

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...