Jump to content

Question

Posted (edited)

[ @kiynox ] could this script be any better?

function menus()

 choices = gg.choice({'Prepare spam','Search','Exit'})

 if choices == nil then

  os.exit()

 else

  if choices == 3 then

   os.exit()

  else

   prepares(choices)

  end

 end

end

 

function prepares(choices)

 if choices == 1 then

gg.clearResults()

gg.searchNumber("9;74;8.0", gg.TYPE_FLOAT)

gg.refineNumber('74', gg.TYPE_FLOAT)

chatspam = gg.getResults(gg.getResultsCount())

gg.addListItems(chatspam) 

 

 elseif choices == 2 then

gg.loadResults(chatspam)

gg.getResults(1000)

chatspam = gg.prompt({"Enter which letter you want to spam?(0 = A, 1 = B, 2 = C, 3 = D, 4 = E, 5 = F, 6 = G, 7 = H, 8 = I, 9 = J, 10 = K, 11 = L, 12 = M, 13 = N, 14 = O, 15 = P, 16 = Q, 17 = R, 18 = S, 19 = T, 20 = U, 21 = V, 22 = W, 23 = X, 24 = Y, 25 = Z)"},

{[1] ="0"},

{["1"] ="number"})

if chatspam == nil then 

    gg.alert("you haven't searched anything so the script will restart!")

    return 

end

 

gg.editAll(chatspam[1] ,gg.TYPE_FLOAT)

chatspam = gg.getResults(gg.getResultsCount())

 

 end

end

 

 

knxs = false

while true do

 if gg.isVisible(true) then

  knxs = true

 else

  knxs = false

 end

 if knxs == true then

  menus()

 else

  gg.setVisible(false)

 end

end

Edited by _yourram

Recommended Posts

  • 0
Posted

@Count_Nosferatu 】

---

1 hour ago, _yourram said:

can you give me an example or can you correct me ↓

No need anymore, I found out my mistake, thanks for the help!

  • 0
Posted (edited)

@MANDO01 】

---

11 hours ago, _yourram said:

It is working but when I added 3rd search result I got error 😞

-- 1st Search Results ↓
gg.searchNumber("8243116118139640283", 32)
gg.refineNumber("8243116118139640283", 32)

-- Check if there are results
if gg.getResultsCount() > 0 then
local t = gg.getResults(1)

for i,v in pairs(t) do
t[i].address = t[i].address - 0xC
t[i].flags = 4
t[i].value = 0
t[i].freeze = false
gg.setValues(t)
end

local t = gg.getResults(10)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 0
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)

local t = gg.getResults(10)

-- for how many milliseconds do you want to spawn troll? (1 second = 1000)
gg.sleep(1060)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 190
t[i].freeze = true
gg.addListItems(t)
end

gg.setValues(t)
gg.removeListItems(t)
gg.clearResults()
else

 -- 2nd Search Results ↓
gg.searchNumber("8243116118138469840", 32)
gg.refineNumber("8243116118138469840", 32)

-- Check if there are results
if gg.getResultsCount() > 0 then
local t = gg.getResults(1)

for i,v in pairs(t) do
t[i].address = t[i].address - 0xC
t[i].flags = 4
t[i].value = 0
t[i].freeze = false
gg.setValues(t)
end
local t = gg.getResults(10)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 0
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)

local t = gg.getResults(10)

-- for how many milliseconds do you want to spawn troll? (1 second = 1000)
gg.sleep(1060)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 190
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)
gg.removeListItems(t)
gg.clearResults()
else

-- 3rd Search Results ↓
gg.searchNumber("8243116618139970289", 32)
gg.refineNumber("8243116618139970289", 32)  
-- Check if there are results
if gg.getResultsCount() > 0 then 
local t = gg.getResults(1)

for i,v in pairs(t) do
t[i].address = t[i].address - 0xC
t[i].flags = 4
t[i].value = 0
t[i].freeze = false
gg.setValues(t)
end
local t = gg.getResults(10)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 0
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)

local t = gg.getResults(10)

-- for how many milliseconds do you want to spawn troll? (1 second = 1000)
gg.sleep(1060)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 190
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)
gg.removeListItems(t)
gg.clearResults()
else 

-- 4th Search Results ↓
gg.searchNumber("8233116118137472811", 32)
gg.refineNumber("8233116118137472811", 32)  
-- Check if there are results
if gg.getResultsCount() > 0 then
local t = gg.getResults(1)

for i,v in pairs(t) do
t[i].address = t[i].address - 0xC
t[i].flags = 4
t[i].value = 0
t[i].freeze = false
gg.setValues(t)
end
local t = gg.getResults(10)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 0
t[i].freeze = true
gg.addListItems(t)
end
gg.setValues(t)
local t = gg.getResults(10)

-- for how many milliseconds do you want to spawn troll? (1 second = 1000)
gg.sleep(1060)

for i,v in pairs(t) do
t[i].address = t[i].address + 0x2C
t[i].flags = 16
t[i].value = 190
t[i].freeze = true
gg.addListItems(t)
end

gg.setValues(t)
gg.removeListItems(t)
gg.clearResults()
end

I found the solution, thanks for not replying 😇

Edited by _yourram
  • 0
Posted

[ @_yourram ]
---
You need to understand 2 things: global variable & function argument:

  • - Variable 'troll' from "BOSS1" can't be accessed in "BOSS2" because it is not a global variable, meaning it can only be accessed in the same function ONLY.
  • - In order this to work, you need to pass the variable 'troll' into 'BOSS2' function as an argument, or, you can create a global variable to store your values.

---
[ Global variable ]

global_variable = {"troll": {}}

function BOSS1()
	gg.searchNumber("8243116118139470283", 32)
	gg.refineNumber("8243116118139470283", 32)
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll)
	gg.clearResults()

	gg.searchNumber("8243116118139479840", 32)
	gg.refineNumber("8243116118139479840", 32)
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems( troll)
	gg.clearResults()

	-- 3rd Search Results ↓
	gg.searchNumber("8143116118139470289", 32)
	gg.refineNumber("8143116118139470289", 32)  
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll)
	gg.clearResults()

	-- 4th Search Results ↓
	gg.serchNumber("9243116118139472811", 32)
	gg.refineNumber("9243116118139472811", 32)  
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll) 
	gg.clearResults()
end

function BOSS2()
	gg.loadResults(global_variable.troll)
	os.exit()
end 

---
[ Passing variable ]

function BOSS1()
	gg.searchNumber("8243116118139470283", 32)
	gg.refineNumber("8243116118139470283", 32)
	troll = gg.getResults(gg.getResultsCount())
	
	--passing 'troll' to BOSS2
	BOSS2(troll)

	gg.addListItems(troll)
	gg.clearResults()

	--the rest of the code
end

function BOSS2(troll)
	gg.loadResults(troll)
	os.exit()
end 

---

  • 0
Posted (edited)

@kiynox

---

13 minutes ago, kiynox said:

You need to understand 2 things: global variable & function argument:

  • - Variable 'troll' from "BOSS1" can't be accessed in "BOSS2" because it is not a global variable, meaning it can only be accessed in the same function ONLY.
  • - In order this to work, you need to pass the variable 'troll' into 'BOSS2' function as an argument, or, you can create a global variable to store your values.

---
[ Global variable ]

global_variable = {"troll": {}}

function BOSS1()
	gg.searchNumber("8243116118139470283", 32)
	gg.refineNumber("8243116118139470283", 32)
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll)
	gg.clearResults()

	gg.searchNumber("8243116118139479840", 32)
	gg.refineNumber("8243116118139479840", 32)
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems( troll)
	gg.clearResults()

	-- 3rd Search Results ↓
	gg.searchNumber("8143116118139470289", 32)
	gg.refineNumber("8143116118139470289", 32)  
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll)
	gg.clearResults()

	-- 4th Search Results ↓
	gg.serchNumber("9243116118139472811", 32)
	gg.refineNumber("9243116118139472811", 32)  
	troll = gg.getResults(gg.getResultsCount())
	for k, v in ipairs(troll) do
		global_variable[#global_variable + 1] = v
	end
	gg.addListItems(troll) 
	gg.clearResults()
end

function BOSS2()
	gg.loadResults(global_variable.troll)
	os.exit()
end 

Alright, thanks bro you always help me 🤝

↓need another help, how can I save only 100 value in float type using this function↓

local function setAddr(addr, flags, value, freeze)

local t = {}

  t[1] = {}

  t[1].address = addr

  t[1].flags = flags

  t[1].value = value

  t[1].freeze = freeze

gg.setValues(t)

gg.addListItems(t)

end

gg.searchNumber("-7041975695332343808", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)

gg.refineNumber("-7041975695332343808")

local r = gg.getResults(10)

for _, v in ipairs(r) do

  local addr = v.address + 0x80

  setAddr(addr, 16, "140", false)

end

for _, v in ipairs(r) do

  local addr = v.address - 0x0 

  setAddr(addr, 16, "100", false)

end

for _, v in ipairs(r) do

  local addr = v.address - 0x50

  setAddr(addr, 16, "800", false)

end

Edited by _yourram
  • 0
Posted (edited)

[ @_yourram ]
---

Quote

how can I save only 100 value in float type using this function↓

What do you mean? Do you want to edit all the results to float '100' or getting '100' results? If you want to get 100 results, just change '10' to '100':

gg.getResults(100)

---

Edited by kiynox
  • 0
Posted

【 @kiynox 】

---

29 minutes ago, _yourram said:

↓need another help, how can I save only 100 value in float type using this function↓

local function setAddr(addr, flags, value, freeze)

local t = {}

  t[1] = {}

  t[1].address = addr

  t[1].flags = flags

  t[1].value = value

  t[1].freeze = freeze

gg.setValues(t)

gg.addListItems(t)

 As you can see here gg.addListItems(t) is what saves all my edits, so I am asking how can I save only 100(local address = v.address - 0x0)edited values while using this function.

  • 0
Posted

[ @_yourram ]
---

Quote

so I am asking how can I save only 100(local address = v.address - 0x0)edited values while using this function.

There's nothing wrong with this script. The 'setAddr' function is depends on gg.getResults, so if there's 100 result, the function will also add 100 result into the 'saved list'. If you're talking about editing 100 result simultaneously with 'setAddr' function, then:

function setAddr(results, offset, value, flags)
	for key, value in ipairs(results) do
		results[key].address = results[key].address - offset
		results[key].value = value
		results[key].flags = flags
	end
	gg.setValues(results)
	gg.addListItems(results)
end

gg.searchNumber("-7041975695332343808", gg.TYPE_QWORD, false, gg.SIGN_EQUAL, 0, -1, 0)
gg.refineNumber("-7041975695332343808")
local r = gg.getResults(100)
setAddr(r, 0x0, 100, gg.TYPE_FLOAT)

---

  • 0
Posted (edited)

@kiynox 】bro, do you have better commands for this or can you correct me what mistakes I am doing ↓

local gg = gg

local s = 1136216893891

local offset = { 0x1C, 0x1C, 0x1C}

local r = {}

gg.clearResults()

gg.searchNumber(s,32)

if gg.getResultCount()==0 then

    print('No results found.')

    os.exit()

end

local t = gg.getResults(10)

trex = gg.prompt({'For how many milliseconds do you want to spawn trex? (1000 = 1 sec)'},

               {[1]='0'},

               {[1]='number'})

               if trex == nil then

                 alert('It has to be at least 1 millisecond')

    return

end

 

for i,v in ipairs(t) do

 

    r = {

        [1] = {

            address = v.address-offset[1],

            flags = 1,

            value = 0,

            name = 'Instant respawn'..i..',1'

        },

        [2] = {

            address = v.address+offset[2],

            flags = 16,

            value = 0,

            freeze = true,

            name = 'Trex spawn'..i..',2'

        },

 

-- for how many milliseconds do you want to spawn trex? 

gg.sleep(trex[1])

               

        [3] = {

            address = v.address+offset[3],

            flags = 16,

            value = 190,

            freeze = true,

            name = 'Trex spawn'..i..',2'

     },

    }

    gg.setValues(r)

    gg.addListItems(r)

end

gg.toast("yourram")

gg.clearResults()

---

Edited by _yourram
  • 0
Posted (edited)

[ @_yourram ]
---

if trex == nil then
	alert('It has to be at least 1 millisecond')
	return
end

You put 'return' here, it is wrong. 'return' statement is used to exit a function: LUA 4.4: break and return. If you want to trigger gg.prompt again, then use goto statement:

::redo::
trex = gg.prompt({'For how many milliseconds do you want to spawn trex? (1000 = 1 sec)'}, {[1]='0'}, {[1]='number'})
if trex == nil then
	alert('It has to be at least 1 millisecond')
	goto redo
end

---

    r = {
        [1] = {
            address = v.address-offset[1],
            flags = 1,
            value = 0,
            name = 'Instant respawn'..i..',1'
        },
        [2] = {
            address = v.address+offset[2],
            flags = 16,
            value = 0,
            freeze = true,
            name = 'Trex spawn'..i..',2'
        },
-- for how many milliseconds do you want to spawn trex? 
		gg.sleep(trex[1])
        [3] = {
            address = v.address+offset[3],
            flags = 16,
            value = 190,
            freeze = true,
            name = 'Trex spawn'..i..',2'
     },

You're executing a gg.sleep() function inside a table, this is wrong. You can't execute a function inside a table. What you need is to separate 'instant respawn' and 'trex spawn'.

local gg = gg
local s = 1136216893891
local offset = { 0x1C, 0x1C, 0x1C}
local r = {}
gg.searchNumber(s,32)
if gg.getResultCount() == 0 then
    print('No results found.')
    os.exit()
end
local t = gg.getResults(10)
gg.clearResults()

::redo::
trex = gg.prompt({'For how many milliseconds do you want to spawn trex? (1000 = 1 sec)'}, {[1]='0'}, {[1]='number'})
if trex == nil then
	alert('It has to be at least 1 millisecond')
	goto redo
end

--Applying instant respawn
for i, v in ipairs(t) do
    r = {{
		address = v.address-offset[1],
		flags = 1,
		value = 0,
		name = 'Instant respawn'..i..',1'
	}}
    gg.setValues(r)
    gg.addListItems(r)
end

while true do
	for i, v in ipairs(t) do
		r = {{
			address = v.address+offset[2],
			flags = 16,
			value = 0,
			freeze = true,
			name = 'Trex spawn'..i..',2'
		},
		{
			address = v.address+offset[3],
			flags = 16,
			value = 190,
			freeze = true,
			name = 'Trex spawn'..i..',2'
		}}
		gg.setValues(r)
	end
	gg.sleep(trex[1])
end

---
*Do note that: the script above runs infinitely, you need to put some condition in order to exit it.

Edited by kiynox
  • 0
Posted

[ @_yourram ]
---

Quote

Are you on social media like Instagram or Discord?

Currently no, you can just contact me here. I'm always available.
---

  • 0
Posted

@kiynox 】

---

42 minutes ago, kiynox said:

Currently no, you can just contact me here. I'm always available.

can you explain me in depth about this script function what is happening in this script ↓

gg.clearResults()

gg.setRanges(gg.REGION_C_ALLOC)

gg.searchNumber(':nDstDist', 1)

gg.refineNumber('110', 1)

maintest = gg.getResults(6)

gg.clearResults()

maintest2 = maintest[1].address - 0x18

gg.searchNumber(maintest2, 32)

local results = gg.getResults(19)

local resultnumber = {1}

local elements = {}

for i, v in ipairs(resultnumber) do

if results[v] ~= nil then

table.insert(elements, {address = results[v].address, flags = 16,value = "-9e9"})

end

end

 

if #elements > 0 then

gg.setValues(elements)

end

for i, v in ipairs(resultnumber) do

if results[v] ~= nil then

table.insert(elements, {address = results[v].address, flags = 16, value = "9e9"})

end

end

if #elements > 0 then

gg.setValues(elements)

end

gg.clearResults()

---

  • 0
Posted
30 minutes ago, _yourram said:

can you explain me in depth about this script function what is happening in this script

 

local resultnumber = {1}
print(resultnumber)

--> { -- table(d2fd880)
-->	[1] = 1,
--> }

 

  • 0
Posted

【  @Count_Nosferatu

---

38 minutes ago, Count_Nosferatu said:
local resultnumber = {1}
print(resultnumber)

--> { -- table(d2fd880)
-->	[1] = 1,
--> }

what are you tryin to say?

---

  • 0
Posted

[ @_yourram ]
---

Quote

can you explain me in depth about this script function what is happening in this script ↓

There's a lot of errors, but I will only explain:

--Clearing results
gg.clearResults()
--Set memory region to Ca
gg.setRanges(gg.REGION_C_ALLOC)
--Search string: "nDstDist"
gg.searchNumber(':nDstDist', 1)
--Refining results that only contain '110' (I have no idea why)
gg.refineNumber('110', 1)
--Saving results as variable 'maintest'
maintest = gg.getResults(6)
--Clearing results
gg.clearResults()
--Taking address of the first result of 'maintest', then use offset -0x18 from the address.
maintest2 = maintest[1].address - 0x18
--Searching address of 'maintest2' (I have no idea why)
gg.searchNumber(maintest2, 32)
--Saving results as variable 'results'
local results = gg.getResults(19)
--(A table that only contain 1, why? (I have no idea why)
local resultnumber = {1}
--Temporary table to store items
local elements = {}
--Enumerating table 'resultnumber' that only contain 1, what? (I have no idea why)
for i, v in ipairs(resultnumber) do
--Check if 'v' is not empty
if results[v] ~= nil then
--Adding table: {address = results[v].address, flags = 16,value = "-9e9"}, to table 'elements'
table.insert(elements, {address = results[v].address, flags = 16,value = "-9e9"})
end
end

--Checking if table 'elements' has more than 0 item
if #elements > 0 then
--Applying changes in table 'elements' to memory
gg.setValues(elements)
end

---

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