0% found this document useful (0 votes)
24 views2 pages

Lua Script for Name Modification in GG

The document contains a Lua script for modifying player names in a game using the GameGuardian tool. It includes functions to check if the name is in UTF-16 format, set a new name, find an existing name, and prompt the user for input. The script continuously runs in a loop, waiting for user interaction to search for or modify player names.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Lua Script for Name Modification in GG

The document contains a Lua script for modifying player names in a game using the GameGuardian tool. It includes functions to check if the name is in UTF-16 format, set a new name, find an existing name, and prompt the user for input. The script continuously runs in a loop, waiting for user interaction to search for or modify player names.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

function isUTF16(utf16)

local stringTag
local addressJump
if utf16 == true then
stringTag = ';'
addressJump = 2
else
stringTag = ':'
addressJump = 1
end
return stringTag, addressJump
end

function setNewName()
local stringTag, addressJump = isUTF16(playername[2])
local t = [Link]([Link]())
local replaceString = {}
local stringSize = {}
local str = {}
[Link]()
for i= 1, #editname[1] do
str[i] = [Link](editname[1], i, j)
end
for i = 1, #t do
stringSize[#stringSize + 1] = {address = t[i].address - 0x4, flags =
gg.TYPE_WORD}
for charCount = 1, #editname[1] do
replaceString[#replaceString + 1] = {address = t[i].address, flags =
gg.TYPE_WORD, value = [Link]([Link](str[charCount], 1, 1))}
t[i].address = t[i].address + addressJump
end
end
stringSize = [Link](stringSize)
for i, v in ipairs(stringSize) do
if [Link] == #playername[1] then -- only sets value for strings that have a
string length value
[Link] = #editname[1]
end
end
[Link](stringSize)
[Link](replaceString)
[Link]("New name set")
end

function findName()
local stringTag, addressJump = isUTF16(playername[2])
[Link](stringTag..playername[1])
local a = [Link]([Link]())
if #a == 0 then
[Link]("name not found, search again")
else
local stringLength = #playername[1]
for i = 1, stringLength do
[Link](stringTag..[Link](playername[1], 1, stringLength)) --
refine string name
stringLength = stringLength - 1
end
prompt_edit()
end
end

function noselect()
[Link]('You not select anything')
end

function prompt_edit()
editname = [Link](
{[1] = 'Input name to modify to'},
{[1] = '0'},
{[1] = 'text'})
if editname == nil then
noselect()
[Link]()
else
setNewName()
end
end

function prompt_search()
playername = [Link](
{[1] = 'Input name to search for' ,[2] = 'UTF 16'},
{[1] = '0' ,[2] = false},
{[1] = 'text' ,[2] = 'checkBox'})
if playername == nil then
noselect()
else
findName()
end
end

while (true) do
if [Link]() then
[Link](false)
prompt_search()
end
[Link](100)
end

You might also like