Jump to content

Text(string) issue


Platonic
 Share

Recommended Posts

I have a lil issue, I`m working on a cheat were players can make there nickname anonym, but for that I need them to type there name in that text string box of you.

but how do I let the text box appear when they press on my hack, they have then to put there name manualy and the script has to do the rest.

I found this from one of the postes here:
 

gg.clearResults()

function searchText(text)
    local bytes = gg.bytes(text, 'UTF-8')
    local ret = ''
    for i, b in ipairs(bytes) do
        ret = ret .. ';' .. b
    end
    ret = ret:sub(2)..'::'..#bytes
    return gg.searchNumber(ret, gg.TYPE_BYTE)
end

searchText('rfde')

function replaceText(text)
    local bytes = gg.bytes(text, 'UTF-8')
    local all = gg.getResults(100000)
    local len = #bytes
    for i, t in ipairs(all) do
        t.value = bytes[((i - 1) % len) + 1]
    end
    return gg.setValues(all)
end

replaceText('gold')



but here it search already automatic

Link to comment
Share on other sites

Here ya go

function entername()
--opens prompt
 playername = gg.prompt({[1] = 'Enter the player name.'},
{[1] = '0'},
{[1] = 'text'})

    if playername == nil then
        gg.alert('You did not enter anything')
        home()

    else
    -- the variable playername[1] holds the value entered
    gg.alert('The Player name ' .. playername[1] ..  ' was entered')
    end
end

here is a text file with it in it since things tend to get messed up when copying and pasting from the forums

demo.txt

Edited by BadCase
Link to comment
Share on other sites

6

Screenshot_20181122-194313.png

_______________________________________________
added 1 minute later

His is supposed to be a combination of both the codes? 

10 hours ago, BadCase said:

Here ya go

function entername()
--opens prompt
 playername = gg.prompt({[1] = 'Enter the player name.'},
{[1] = '0'},
{[1] = 'text'})

    if playername == nil then
        gg.alert('You did not enter anything')
        home()

    else
    -- the variable playername[1] holds the value entered
    gg.alert('The Player name ' .. playername[1] ..  ' was entered')
    end
end

here is a text file with it in it since things tend to get messed up when copying and pasting from the forums

demo.txt

 

Link to comment
Share on other sites

25 minutes ago, XxhentaixX said:

6

Screenshot_20181122-194313.png

_______________________________________________
added 1 minute later

His is supposed to be a combination of both the codes? 

 

it is a function that you can call when they select a button in your script, with  entername() put whatever you want it to do after the name is entered where the gg.alert() is

 

Link to comment
Share on other sites

8 hours ago, BadCase said:

it is a function that you can call when they select a button in your script, with  entername() put whatever you want it to do after the name is entered where the gg.alert() is

 

yes but I mean its not searching for the giving text. it has to search the text string but it aint doing it, afther the scrfipt has his results I need to put in the script that it has to edit to my desired value (in byte)

Link to comment
Share on other sites

1 hour ago, XxhentaixX said:

whenever I put something in the code were you said "else" it brings me back to the beginning. issue is I don't know how to let the script search the nickname that the player gived, and then for me to edit it.

Pretty sure that would only happen if you put entername() in that area as that would call the function again

Link to comment
Share on other sites

5 hours ago, BadCase said:

Pretty sure that would only happen if you put entername() in that area as that would call the function again

I did not, I actualy simply was using your code to see how works out. is it possible for you to give me like a examble were it search in UTF16 and were the script automaticly edits all bytes to value 1 ?

Link to comment
Share on other sites

On 11/23/2018 at 4:22 PM, XxhentaixX said:

is it possible for you to give me like a examble were it search in UTF16 and were the script automaticly edits all bytes to value 1 ?

Here is an example that you have asked for. Function to search text was taken from this post.

function searchText(text, encoding)
  local bytes = gg.bytes(text, encoding)
  local ret = ''
  for i, b in ipairs(bytes) do
    ret = ret..';'..b
  end
  ret = ret:sub(2)..'::'..#bytes
  return gg.searchNumber(ret, gg.TYPE_BYTE)
end

function getResultsCount()
  if gg.getResultsCount then
    return gg.getResultsCount()
  end
  return gg.getResultCount()
end

local input = gg.prompt({'Input string to search:'}, nil, {'text'})
local str = ''
if input == nil then
  -- Something to do if the prompt window was cancelled (this block can be omitted)
end
if input ~= nil then
  str = input[1]
end
if #str > 0 then
  gg.clearResults()
  searchText(str, 'UTF-16')
  gg.getResults(getResultsCount())
  gg.editAll('1', gg.TYPE_BYTE)
end

text_search.lua

 

Link to comment
Share on other sites

2 hours ago, CmP said:

Here is an example that you have asked for. Function to search text was taken from this post.


function searchText(text, encoding)
  local bytes = gg.bytes(text, encoding)
  local ret = ''
  for i, b in ipairs(bytes) do
    ret = ret..';'..b
  end
  ret = ret:sub(2)..'::'..#bytes
  return gg.searchNumber(ret, gg.TYPE_BYTE)
end

function getResultsCount()
  if gg.getResultsCount then
    return gg.getResultsCount()
  end
  return gg.getResultCount()
end

local input = gg.prompt({'Input string to search:'}, nil, {'text'})
local str = ''
if input == nil then
  -- Something to do if the prompt window was cancelled (this block can be omitted)
end
if input ~= nil then
  str = input[1]
end
if #str > 0 then
  gg.clearResults()
  searchText(str, 'UTF-16')
  gg.getResults(getResultsCount())
  gg.editAll('1', gg.TYPE_BYTE)
end

text_search.lua

 

I see, thanks a lot for the examble, but when I search a word with the code you provided to me, it does not find anything, it also search like realy different the string search we can use in the GG.

Link to comment
Share on other sites

His is supposed to be a combination of both the codes? 

On 11/22/2018 at 12:41 PM, BadCase said:

Here ya go

function entername()
--opens prompt
 playername = gg.prompt({[1] = 'Enter the player name.'},
{[1] = '0'},
{[1] = 'text'})

    if playername == nil then
        gg.alert('You did not enter anything')
        home()

    else
    -- the variable playername[1] holds the value entered
    gg.alert('The Player name ' .. playername[1] ..  ' was entered')
    end
end

here is a text file with it in it since things tend to get messed up when copying and pasting from the forums

demo.txt

Screenshot 1 is from the gameguardian and screenshot 2 from the script. But they both search the same word but they search like in diffrent text or utf i dont know

Screenshot_20181129-225624.png

Screenshot_20181129-225605.png

Link to comment
Share on other sites

21 minutes ago, XxhentaixX said:

I see, thanks a lot for the examble, but when I search a word with the code you provided to me, it does not find anything, it also search like realy different the string search we can use in the GG.

Are you sure that string that you are searching for is encoded in UTF-16 in process memory? You may try other encodings from available ones (see "bytes" function description in GG API reference).

Edit: Those 2 bytes at start of the array from your second screenshot is byte order mask. You need to use "UTF-16LE" encoding in your case. I am not sure that BOM won't be included if you choose it, give it a try.

Edited by CmP
Added info
Link to comment
Share on other sites

8 minutes ago, CmP said:

Are you sure that string that you are searching for is encoded in UTF-16 in process memory? You may try other encodings from available ones (see "bytes" function description in GG API reference).

I gues. Are you telling me that searching UTF-16 With gameguardian is diffrent then searching a text in UTF-16 In the script? If i search the same word "Abuel9amai" and get results with gameguardian but not with the script..what would be the reason then? Please explain to me what is wrong here because i don't understand much about bytes and strings.

_______________________________________________
added 4 minutes later

Wait. I get what you mean. In gg its saya UTF-16 but it not only gives UTF-16. In the script it will only find UTF-16 text..nothing else...right?

Link to comment
Share on other sites

3 minutes ago, XxhentaixX said:

Are you telling me that searching UTF-16 With gameguardian is diffrent then searching a text in UTF-16 In the script?

Here is a part from the script that is used in GG for text search:

if utf16 then
  encoding = 'UTF-16LE'
end

It means that "UTF-16LE" encoding is used if user selects corresponding option (via checkbox). So, if you need same result as in GG text search, then use this encoding. Also check my previous comment, I have added info that explains why you got different result when "UTF-16" encoding was set.

Link to comment
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
 Share

×
×
  • 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.