[ @_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.