Jump to content
  • 0

Unexpected error


MAARS

Question

Hi everyone i am facing problems with my script, i dont kwon why but when i use the function

gg.setValues(table)

i am getting this error 

`	gg.setValues(lak)`
bad argument for key 'value': string expected, got nil (field 'setValues')
level = 1, const = 7, proto = 0, upval = 2, vars = 2, code = 10
CALL v0..v1
 ; PC 8 CODE 0100401D OP 29 A 0 B 2 C 1 Bx 1025 sBx -130046

That i dont understand is why the function setValues expect a string as parameters ? normaly it is always a table as parameters. So this is my script bellow.

 

local gg = gg
local die = os.exit
function Home()
	debug = -1
	local menu = gg.choice({"L.A.K", "Verr power", "Severance", "Exit"}, "0", "HOME MENU")
	if menu == nil then gg.toast("You canceled the dialogue")
	elseif menu == 1 then LAK()
	elseif menu == 2 then VerrPower()
	elseif menu == 3 then Severance()
	elseif menu == 4 then os.exit()
	end
end
-- == Parse switch config
SwitchOn = '[ ON ] '
SwitchOff = '[ OFF ] '
----------- ==
-- == Parse edit cheating data
local lak_aimbot = {}
lak_aimbot.On = function()
	lak['aimbot'].value = '0'
	lak['aimbot'].freeze = true
	gg.setValues(lak)
end
lak_aimbot.Off = function()
	lak['aimbot'].value = '2034'
	lak['aimbot'].freeze = true
	gg.setValues(lak)
end
local lak_ammo = {}
lak_ammo.On = function()
	lak['ammo'].value = '1000'
	lak['ammo'].freeze = true
	gg.setValues(lak)
end
lak_ammo.Off = function()
	lak['ammo'].value = '49'
	lak['ammo'].freeze = true
	gg.setValues(lak)
end
local lak_reload = {}
lak_reload.On = function()
	lak['reload'].value = '36'
	lak['reload'].freeze = true
	gg.setValues(lak)
end
lak_reload.Off = function()
	lak['reload'].value = '35'
	lak['reload'].freeze = true
	gg.setValues(lak)
end
local lak_range = {}
lak_range.On = function()
	lak['range'].value = '50000'
	lak['range'].freeze = true
	gg.setValues(lak)
end
lak_range.Off = function()
	lak['range'].value = '184'
	lak['range'].freeze = true
	gg.setValues(lak)
end
local lak_fireRate = {}
lak_fireRate.On = function()
	lak['fireRate'].value = '35'
	lak['fireRate'].freeze = true
	gg.setValues(lak)
end
lak_fireRate.Off = function()
	lak['fireRate'].value = '34.70000076294'
	lak['fireRate'].freeze = true
	gg.setValues(lak)
end
-------------- ==
function LAK()
	-- ['searchNumber'] = function (text, type, encrypted, sign, memoryFrom, memoryTo, limit) end, -- gg.searchNumber(string text [, int type = gg.TYPE_AUTO [, bool encrypted = false [, int sign = gg.SIGN_EQUAL [, long memoryFrom = 0 [, long memoryTo = -1 [, long limit = 0]]]]]]) -> true || string with error
	debug = -1
	if not lak then
		gg.clearResults()
		gg.setRanges(gg.REGION_C_ALLOC)
		gg.searchNumber("265,445.0;264,865.0:5", 16, false, 536870912, 0, -1, 0)
		local r = gg.getResults(1)
		local addr = r[1].address
		lak = {
			['aimbot'] = {
				['address'] = addr - 0x14,
				['flags'] = 16,
			},
			['ammo'] = {
				['address'] = addr - 0x30,
				['flags'] = 16,
			},
			['reload'] = {
				['address'] = addr - 0x38,
				['flags'] = 16,
			},
			['range'] = {
				['address'] = addr - 0x10,
				['flags'] = 16,
			},
			['fireRate'] = {
				['address'] = addr - 0xfc,
				['flags'] = 16,
			}
		}
	end
	if SwitchAB == nil then SwitchAB = SwitchOff end
	if SwitchAM == nil then SwitchAM = SwitchOff end
	if SwitchRD == nil then SwitchRD = SwitchOff end
	if SwitchRG == nil then SwitchRG = SwitchOff end
	if SwitchFR == nil then SwitchFR = SwitchOff end
	local menu = gg.multiChoice({
		SwitchAB .. 'Aimbot',
		SwitchAM .. 'Ammo',
		SwitchRD .. 'Reload',
		SwitchRG .. 'Range',
		SwitchFR .. 'Fire Rate'}, {}, "LAK MENU")
	if menu == nil then gg.setVisible(false) gg.toast('You canceled the dialogue') return nil end
	
	if menu[1] == true then
		if SwitchAB == SwitchOff then
			lak_aimbot.On(); SwitchAB = SwitchOn
		else
			lak_aimbot.Off(); SwitchAB = SwitchOff
		end
	end
	if menu[2] == true then
		if SwitchAM == SwitchOff then
			lak_ammo.On(); SwitchAM = SwitchOn
		else
			lak_ammo.Off(); SwitchAM = SwitchOff
		end
	end
	if menu[3] == true then
		if SwitchRD == SwitchOff then
			lak_reload.On(); SwitchRD = SwitchOn
		else
			lak_reload.Off(); SwitchRD = SwitchOff
		end
	end
	
	if menu[4] == true then
		if SwitchRG == SwitchOff then
			lak_range.On(); SwitchRG = SwitchOn
		else
			lak_range.Off(); SwitchRG = SwitchOff
		end
	end
	if menu[5] == true then
		if SwitchFR == SwitchOff then
			lak_fireRate.On(); SwitchFR = SwitchOn
		else
			lak_fireRate.Off(); SwitchFR = SwitchOff
		end
	end
end
while true do
	if gg.isVisible(true) then
		gg.setVisible(false) debug = 1
	end
	if debug == 1 then Home() end
end

Thank you all.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

The error occurs because at least one of sub-tables has no "value" field specified when you pass the table to "setValues" function.

To set "value" fields of all sub-tables to current values of the elements, the following code can be added right after definition of "lak" table: 

lak = gg.getValues(lak)
Link to comment
Share on other sites

2 minutes ago, CmP said:

The error occurs because at least one of sub-tables has no "value" field specified when you pass the table to "setValues" function.

To set "value" fields of all sub-tables to current values of the elements, the following code can be added right after definition of "lak" table: 


lak = gg.getValues(lak)

Thanks i am gonna try

Link to comment
Share on other sites

@CmP 

Thank you bro it worked but i got another issue. i add the following code above the freeze is working. but when i edit later in the mod menu the value stay the same need to remove freeze before edit ?

['fireRate'] = {
				['address'] = addr - 0xfc,
				['flags'] = 16,
			}
		}
		lak = gg.getValues(lak)
		for k, v in pairs(lak) do
			v.freeze = true
		end
		print (lak)
		gg.addListItems(lak)

 

Link to comment
Share on other sites

2 hours ago, MAARS said:

need to remove freeze before edit ?

If the value is frozen and you need to change it to other value without changing freeze state of the value, then modify "value" field of required sub-table and call "addListItems" function. Doing the same, but calling "setValues" function doesn't work for frozen values, if I am not mistaken.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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