Jump to content

multichoice problem


Recommended Posts

hey, im trying to make a multichoice, but when I press outside the script, the script simply opens again, I think it has something to do with me not putting a nil or something. im realy confused and don`t find any solution.
I`m also trying to put the disable and enabling of the hack in 1.
this is my menu, I would appreciate the help so that I can understand the problem in my script:

 

menu = gg.multiChoice({'No Reload Rockets','No Reload Assault','colors','Level XP','Melee Hack','Performance/FPS hack','Half Chamb(maby not work for your device)','Giant hack (test)','trollRoll Hack(test)'}, {[1]=true, [2]=true})

if menu == nil then else
if menu[1] == true then  noreloadrockets() end
if menu[1] ~= true then  disablenoreloadrockets() end
if menu[2] == true then  noreloadassault() end
if menu[2] ~= true then disablenoreloadassault() end
if menu[3] == true then  clrs() end
if menu[4] == true then  lvxp() end
if menu[5] == true then oni() end
if menu[5] ~= true then offi() end
if menu[6] == true then prefec() end
if menu[7] == true then chambs() end
if menu[8] == true then giant() end
if menu[9] == true then zipmi() end
if menu[9] == false then sahin() end
menuk =-1
end
end

Edited by XxhentaixX
type fault
Link to comment
Share on other sites

1 minute ago, Enyby said:

You need do some action if menu == nil. For example call os.exit.


if menu == nil then 
	os.exit()
else

 

yes my exuse for that, I did do that. it does the action but then the menu simply opens automatic.

I don`t want the menu to close with os.exit, I want it to hide.

Link to comment
Share on other sites

alright I get what you mean.

I may have one last question in connection with the multichoice.


I try to make my script that if if the hack is unselected, the hack will get disabled.  if the hack is selected, the hack will be enabled.

but then there is the last function that has to be added, if the hack is already eneabled, GG wont search it again.

for examble: 


if menu[1] == true then  
noreloadrockets() --[enable the hack]
else
disablenoreloadrockets() --[disable the hack]
end

but the issue is...when there are more hacks added, and "noreloadrockets()" was already enabled before, and I will select another hack, GG will also search for "noreloadrockets" again, and that will be a waste of time I think. it only should search when it has to search.
I got the kind of idea how to do this, but I don`t think I can put it realy in words.

thank you for reply if you read this]

Link to comment
Share on other sites

  • Administrators

So you must keep the current state. For example a flag. If the hack is on, then set the flag, if it is off - reset. And then check if the hack is trying to turn it on, then turn it on only when the flag is reset. Well, with the flag turned off the same story.
Instead of using 10 variables, it's logical to create one table, in which to store the status list of all the flags.

Link to comment
Share on other sites

sadly I do not fully understand what your trying to tell me, I do understand the logic your saying.
I will need to learn that.

for now what I exctualy did may look like this:
 

function abir()

gg.searchNumber(500.0015, gg.TYPE_FLOAT)
if gg.getResultCount() ~= 0 then abir() else
gg.getResults(5)
gg.editAll(1799.99987792969, gg.TYPE_FLOAT)
gg.clearResults()
gg.searchNumber(900.29482, gg.TYPE_FLOAT)
gg.getResults(4)
gg.editAll(9.9999997e-10, gg.TYPE_FLOAT)
gg.clearResults()
gg.toast('hack well done')
end


what happens here  is that when a hack is already selected before, it will search for the value, but it will get 0 results and will go directly to the next hack, so it won`t matter if the hack is enabled or disabled. 

in case it is the first time that it needs to be enabled, it will get results and just do the other part of the code..i know its a lang shot but for now I leack knowledge. I readed the help in 

Link to comment
Share on other sites

  • Administrators

If you need to know whether the hack is applied in the current script start, you need to create a variable. However, if hack could be used in other script runs, the variable will not help and you need to do a test search and check its results.

Link to comment
Share on other sites

so I will need to give the menu a variable?

_______________________________________________
added 2 minutes later

like this:

abis = noreloadrockets()
bis = disablenoreloadrockets()


if menu[1] == true then abis else bis end

Link to comment
Share on other sites

  • Administrators

No.

-- init vars - 1 time on script run
check = {}
-- some code with label
if menu[1] != check[1] then 
  	check[1] = menu[1]
	if menu[1] == true then 
        -- enable hack
    else
        -- disable hack
    end 
end
-- return to label

It is for run in loop.

If you not in loop then you need search before each hack for check - applied hack or not. Analyze count of results. If it zero - skip apply hack.

Link to comment
Share on other sites

5 hours ago, Enyby said:

No.


-- init vars - 1 time on script run
check = {}
-- some code with label
if menu[1] != check[1] then 
  	check[1] = menu[1]
	if menu[1] == true then 
        -- enable hack
    else
        -- disable hack
    end 
end
-- return to label

It is for run in loop.

If you not in loop then you need search before each hack for check - applied hack or not. Analyze count of results. If it zero - skip apply hack.

alright, I tried it like you said: 

check = {}
if menu == nil then os.exit()
if menu[1] != check[1] then check[1] = menu[1] then
if menu[1] == true then =  noreloadrockets() else disablenoreloadrockets() end end
if menu[2] != check[2] then check[2] = menu[2] then
if menu[2] == true then  noreloadassault() else disablenoreloadassault() end end
if menu[3] == true then  clrs() else gg.toast('Color hack can`t be disabled') end
if menu[4] == true then  lvxp() end
if menu[5] != check[5] then check[5] = menu[5] then
if menu[5] == true then oni() else offi() end end
if menu[6] != check[6] then check[6] = menu[6] then
if menu[6] == true then simbi() else abi() end end
if menu[7] != check[7] then check[7] = menu[7] then
if menu[7] == true then abik() else abir() end end
if menu[8] != check[8] then check[8] = menu[8] then
if menu[8] == true then bis() else sis() end end
if menu[9] != check[9] then check[9] = menu[9] then
if menu[9] == true then zipmi() else sahin() end end
menuk =-1
end
end


but it gives a error: "then expected"

Edited by XxhentaixX
Link to comment
Share on other sites

  • Administrators

You need to use indentation, otherwise you will get confused in the code when you write everything in one line. Learn how to format the code. then errors will be immediately visible and the code will be easier to read.

Link to comment
Share on other sites

15 minutes ago, Enyby said:

You need to use indentation, otherwise you will get confused in the code when you write everything in one line. Learn how to format the code. then errors will be immediately visible and the code will be easier to read.

alright, does this looks better ? ?
 

check = {}
if menu == nil then os.exit()
if menu[1] != check[1] then 
  check[1] = menu[1] then
 if menu[1] == true then  
  noreloadrockets() else 
  disablenoreloadrockets() end end

if menu[2] != check[2] then
 check[2] = menu[2] then
 if menu[2] == true then
  noreloadassault() else
  disablenoreloadassault() end end
  
if menu[3] == true then
  clrs() else 
  gg.toast('Color hack can`t be disabled') end
  
if menu[4] == true then
  lvxp() end
  
if menu[5] != check[5] then
 check[5] = menu[5] then
 if menu[5] == true then
  oni() else
  offi() end end
 
if menu[6] != check[6] then
 check[6] = menu[6] then
 if menu[6] == true then
  simbi() else 
  abi() end end
 
if menu[7] != check[7] then
 check[7] = menu[7] then
 if menu[7] == true then
  abik() else
  abir() end end
 
if menu[8] != check[8] then
 check[8] = menu[8] then
 if menu[8] == true then
  bis() else
  sis() end end
 
if menu[9] != check[9] then
 check[9] = menu[9] then
 if menu[9] == true then
  zipmi() else
  sahin() end end
 
menuk =-1
end
end

Edited by XxhentaixX
Link to comment
Share on other sites

  • Administrators

Use code tag.

41 minutes ago, XxhentaixX said:

if menu == nil then os.exit()
if menu[1] != check[1] then 
  check[1] = menu[1] then
 if menu[1] == true then  
  noreloadrockets() else 
  disablenoreloadrockets() end end

Third "then" not have "if".

Besides, I see that you did not understand what I was talking about. Also I see that you do not understand the essence of programming. You need to learn programming, read a book, understand the structure of if and so on. As long as you do not understand this, conversation does not make sense. Besides, I do not have time to explain and explain the basic things.
You simply combine the text, without understanding how it works and what the syntax of the statements is.
Start with books and study lua.

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.