Jump to content

LUA scripting


Enyby
 Share

Recommended Posts

  • 2 weeks later...
  • 3 weeks later...

Is there a way to make the parameter of a function a variable name? This is what I want to do:

varname = {}
varname[1] = {}
varname[1].address = m3[1].address + offset
varname[1].value = value
varname[1].flags = flag
gg.setValues(varname)

I want to make that a function with varname as one of the parameters so that I could have different tables and I could remove from list specific tables later. Or is there a better way?

Link to comment
Share on other sites

You say that to everyone. I am reading on lua. I'm learning everyday. I asked here for help. Anyways I realized what I should do now. I should make the function return the table and assign it to a variable. Thanks for nothing.

Link to comment
Share on other sites

  • Administrators

If a person does not know the basic things, like how to assign a variable a value and whether that functions can accept variables, and not just constants, then he can not be helped. You can only write the code instead.
And programming can not be taught. Man must learn himself.

In your case, I just do not understand what you want. And I do not have time to guess.

But I'm happy for you that you sorted it out, although I did not understand what, because the decision also did not give me an understanding of what you wanted.
At first you said something about passing a variable as a parameter, and now say that you need a function that returns a table.

Link to comment
Share on other sites

Hello. I need help figuring this out.

function maketables2 (of, fl, fr)
	m = gg.getResults(1)
	t = {}
	t.address = m[1].address + of
	if fl == 1 then
		tp = gg.TYPE_BYTE
	elseif fl == 2 then
		tp = gg.TYPE_WORD
	elseif fl == 3 then
		tp = gg.TYPE_DWORD
	end
	t.flags = tp
	if fr == 1 then
		t.freeze = true
		t.freezeType = gg.FREEZE_NORMAL
	end
	return t
end

::FASTERSD::
monster1 = maketables2(-303976, 3)
monster2 = maketables2(-302632‬, 3)
monster3 = maketables2(-301288, 3)
monster4 = maketables2(-299944, 3)
monster5 = maketables2(-298600, 3)
monster6 = maketables2(-297256, 3)
monster7 = maketables2(-295912, 3)
monster8 = maketables2(-294568, 3)
monster9 = maketables2(-293224‬, 3)
monster10 = maketables2(-291880‬, 3)
monster11 = maketables2(-290536, 3)
monster12 = maketables2(-289192, 3)
monster13 = maketables2(-287848, 3)
monster14 = maketables2(-286504, 3)
monster15 = maketables2(-285160, 3)

I can't figure out why only monster2, monster9, and monster10 give out errors. If I remove those three then my script works fine. This is the error:

Script ended:
Perhaps this script needs the latest version of GameGuardian. Try to update to the latest version.

Script error: org.luaj.vm2.LuaError: load /storage/emulated/0/Lua Scripts/fasterchunktest.lua: org.luaj.vm2.LuaError: /storage/emulated/0/Lua Scripts/fasterchunktest.lua:65
`monster2 = maketables2(-3026326¦9, 3)`
')' expected
    at org.luaj.vm2.LuaValue.error(LuaValue.java:1075)
    at org.luaj.vm2.Globals.loadfile(Globals.java:204)
    at android.ext.Script.runScript(Script.java:3294)
    at android.ext.Script$ScriptThread.run(Script.java:3232)
Caused by: org.luaj.vm2.LuaError: /storage/emulated/0/Lua Scripts/fasterchunktest.lua:65
`monster2 = maketables2(-3026326¦9, 3)`
')' expected
    at org.luaj.vm2.compiler.LexState.lexerror(LexState.java:270)
    at org.luaj.vm2.compiler.LexState.syntaxerror(LexState.java:274)
    at org.luaj.vm2.compiler.LexState.error_expected(LexState.java:823)
    at org.luaj.vm2.compiler.LexState.check_match(LexState.java:853)
    at org.luaj.vm2.compiler.LexState.funcargs(LexState.java:1300)
    at org.luaj.vm2.compiler.LexState.suffixedexp(LexState.java:1392)
    at org.luaj.vm2.compiler.LexState.simpleexp(LexState.java:1446)
    at org.luaj.vm2.compiler.LexState.subexpr(LexState.java:1559)
    at org.luaj.vm2.compiler.LexState.expr(LexState.java:1577)
    at org.luaj.vm2.compiler.LexState.explist(LexState.java:1277)
    at org.luaj.vm2.compiler.LexState.assignment(LexState.java:1672)
    at org.luaj.vm2.compiler.LexState.exprstat(LexState.java:1994)
    at org.luaj.vm2.compiler.LexState.statement(LexState.java:2091)
    at org.luaj.vm2.compiler.LexState.statlist(LexState.java:2108)
    at org.luaj.vm2.compiler.LexState.mainfunc(LexState.java:2124)
    at org.luaj.vm2.compiler.LuaC$CompileState.luaY_parser(LuaC.java:129)
    at org.luaj.vm2.compiler.LuaC.compile(LuaC.java:99)
    at org.luaj.vm2.Globals.compilePrototype(Globals.java:323)
    at org.luaj.vm2.Globals.loadPrototype(Globals.java:302)
    at org.luaj.vm2.Globals.load(Globals.java:273)
    at org.luaj.vm2.Globals.loadfile(Globals.java:202)
    ... 2 more

Link to comment
Share on other sites

  • Administrators
34 minutes ago, MCbearbear said:

maketables2(-3026326¦9, 3)`

You do not see nothing unusual? "|9' for example.

Here present some hidden utf-8 chars.

Link to comment
Share on other sites

gg.getResults('Value'

How to get the Value in getResults? Is the getResults('Value') can be get in searchNumber('Value') result?

Thank  you!

Edited by Maplas
Link to comment
Share on other sites

2 hours ago, Enyby said:

Could you please check my script, been sorting out looking for the error but no luck to solve it.

gg.toast('Mobile Legends Script - 1.0.0')

if gg.BUILD < 5511 then 
gg.alert('Outdated! Upgrade Game Guardian to v.8.30.0. or Later!') 
gg.toast('GameGuardian.net!')
end 

if gg.isVisible(true) then 
   gg.setVisible(false) 
   end
 
::menu::
menu = gg.choice({'God Mode','Exit'})
if menu == 1 then goto hero end
if menu == 2 then goto close end

::hero::
if hero == gg.choice({'Layla','Menu','Exit'})
if hero == 1 then goto layla end
if hero == 2 then goto menu end
if hero == 3 then goto close end

::layla::
gg.searchNumber('118;424;2500', gg.TYPE_DWORD, false, gg.SIGN_EQUAL, 0, -1)
gg.getResults(19)print('Replaced: ', gg.editAll('999999', gg.TYPE_DWORD))
gg.toast('Injected!')
goto close

::close::
gg.toast('Script Injected!')
gg.toast('Cheaters!')

Edited by Maplas
Link to comment
Share on other sites

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
 Share

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