Jump to content
  • 0

I tried to simplify this script


ryeisqt1

Question

Okay this is my first time to post something here and I really need help. 

Problem: So this is kinda weird for me because I only know a bit of lua scripting. I tried decrypting some old scripts using some old tools posted here. I will post partial of the script that is not working so I won't offend the owner.

 

You see I have this complicated code to read, when I use it on the game it works well. 

Complicated Script (1st)

 local L1_4
  L1_4 = gg
  L1_4 = L1_4.getRangesList
  L1_4("/data/data/example/")
  L1_4 = gg
  L1_4 = L1_4.clearResults
  L1_4()
  L1_4 = gg
  L1_4 = L1_4.searchNumber
  L1_4("98,784,247,822", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
  L1_4 = gg
  L1_4 = L1_4.getResults
  L1_4 = L1_4(100)
  for _FORV_5_, _FORV_6_ in ipairs(L1_4) do
    if _FORV_6_.flags == gg.TYPE_QWORD then
      _FORV_6_.value = "98,784,247,817"
      _FORV_6_.freeze = true
    end
  end
  gg.toast("ENABLED!")
  gg.setValues(L1_4)
end

I wanted to learn more about the code being used so I tried simplifying it to become readable into this

 

Simplified Script (2nd)

function slot1()
  local bb
  gg.getRangesList("/data/data/example")
  gg.clearResults()
  gg.searchNumber("98,784,247,822", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
  gg.getResults(100)
  for i, j in ipairs(gg.getResults(100)) do
    if j.flags == gg.TYPE_QWORD then
      j.value = "98,784,247,817"
      j.freeze = true
    end
  end
  gg.toast("ENABLED")
  gg.setValues(gg.getResults(100))
end

Now the 2nd which is the result of simplifying the 1st code doesn't work to the game. I don't get it either, Gameguardian doesn't throw any error when I execute the 2nd script yet it doesn't work in the game.

By work I mean this is a script for cheating on the game. The cheat doesn't work on the 2nd simplified script.

Note: the gg.GetRangesList directory file is modified as it reveals the game but both of it have the same directory file. 

Can somebody help me? I mean it's just working fine with the 1st but I really want to learn.. Now I know this isn't really much to get the help that I need since I omitted the other script. But can anyone spot the difference or the mistake I made on the 2nd script?

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Alright it just took a few hours for me to figure it out with my small brain. Anyways, I fixed it. I only had to store the gg.getResults on a local variable. Idk why but it works. Would appreciate if someone would reply 

--Solution
function slot1()
  local bb
  gg.getRangesList("/data/data/example")
  gg.clearResults()
  gg.searchNumber("98,784,247,822", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
  bb = gg.getResults(100)
  for i, j in ipairs(bb) do
    if j.flags == gg.TYPE_QWORD then
      j.value = "98,784,247,817"
      j.freeze = true
    end
  end
  gg.toast("ENABLED")
  gg.setValues(bb)
end

 

Link to comment
Share on other sites

In your rebuilt code you have a mistake of calling "getResults" function 3 times when in original code it is called only once and returned value is used. Applying fix to your code: 

function slot1()
  gg.getRangesList("/data/data/example")
  gg.clearResults()
  gg.searchNumber("98,784,247,822", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
  local results = gg.getResults(100)
  for i, j in ipairs(results) do
    if j.flags == gg.TYPE_QWORD then
      j.value = "98,784,247,817"
      j.freeze = true
    end
  end
  gg.toast("ENABLED")
  gg.setValues(results)
end

Also worth to mention that both original code and your rebuilt version ignore the value returned by "getRangesList" function, so that it doesn't influence anything and can be removed without any difference in code execution result.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.