| View previous topic :: View next topic |
| Author |
Message |
Snytex How do I cheat?
Reputation: 0
Joined: 08 Feb 2023 Posts: 1
|
Posted: Wed Feb 08, 2023 9:23 am Post subject: Swapping Strings in Lua |
|
|
| Hey I've been tryna make a trainer that lets me swap 2 string values with UTF 16 and Case sensitive enabled. Now I did read the Lua Guide but I didnt really get far with it. Could someone please explain how to do that? e.g. the first string value is [Dice] and I want to scan for that, then change the value to [car]. I hope someone can help me.
|
|
| Back to top |
|
 |
LeFiXER Grandmaster Cheater Supreme
Reputation: 20
Joined: 02 Sep 2011 Posts: 1069 Location: 0x90
|
Posted: Wed Feb 08, 2023 9:37 am Post subject: |
|
|
You can use writeString.
| Code: |
writeString(address,text, widechar OPTIONAL) : Write a string to the specified address. Returns true on success
|
More info can be found here: celua.txt
|
|
| Back to top |
|
 |
AylinCE Grandmaster Cheater Supreme
Reputation: 37
Joined: 16 Feb 2017 Posts: 1533
|
Posted: Tue Feb 14, 2023 8:46 am Post subject: |
|
|
Try this;
| Code: | function byteTableToAobString(t)
for k,v in ipairs(t) do
t[k] = ('%02X'):format(v)
end
return table.concat(t, ' ')
end
function TextToAobs(text)
newvalue = (text) --:lower()
--print(newvalue)
if not newvalue then return end
newvalue = stringToByteTable(newvalue)
newvalue = byteTableToAobString(newvalue)
print(newvalue)
return newvalue
end
print(TextToAobs("Zar"))
function multiReplace(from,to)
local good,aob = 0,AOBScan(tostring(from),"+W*XC")
if (aob == nil) then
showMessage("Code not found..")
else
aobCnt=strings_getCount(aob) - 1
for i=0, aobCnt do
if autoAssemble (aob[i]..":\ndb "..tostring(to)) then good=good+1
end
end
end
aob.Destroy()
showMessage("Replace code: " .. good)
return good
end
--use:
multiReplace(TextToAobs("Dice"),TextToAobs("car")) |
_________________
|
|
| Back to top |
|
 |
|