Jump to content
  • 0

help me make menu and correct me


Question

Posted (edited)

hello again, here iam with my curiosity and experiment on lua scripting
today i will make menu and the goal is to switch between language using menu text

before making this, i ve read some past topic posted by RCPOLSKI
heres his topic link RCPOLSI's Topic Link
but i will try to make my version with the goal that i want.

local lang = {'🇬🇧 English'. '🇪🇸 Español'}
local langC = 0
local hackEN = {'Position'. 'Teleport'}
local hackSP = {'Posición'. 'Teletransportarse'}

function SelectLanguage()
	local menu = gg.choice({lang[1], lang[2]}, nil,'ONLY SELECT ONE LANGUAGE')
	if menu == nil then os.exit end
	if menu == 1 then
		langC = 1
	    Main() end
	end
	if menu == 2 then
		langC = 2
	    Main() end
	end
end

function Main()
	if langC == 1 then	
		local menu = gg.choice({hackEN[1], hackEN[2]}, nil,'ONLY SELECT ONE HACK')
		if menu == nil then os.exit end
		if menu == 1 then
			--Position Hack
		end
		if menu == 2 then
			--Teleport Hack
		end
	end
	if langC == 2 then	
		local menu = gg.choice({hackSP[1], hackSP[2]}, nil,'ONLY SELECT ONE HACK')
		if menu == nil then os.exit end
		if menu == 1 then
			--Position Hack
		end
		if menu == 2 then
			--Teleport Hack
		end
	end
end

while true do 
if gg.isVisible() then
   gg.setVisible(false)
   SelectLanguage()
end
gg.sleep(100)
end

i wonder what i write above is correct or not, i havent try it yet.
maybe perhaps, you can shorten the script text length?

Edited by chandelier

2 answers to this question

Recommended Posts

  • 1
Posted (edited)
local lang = {' English',' Español'}
local selectHack = {"ONLY SELECT ONE HACK", "ELIGE SOLO UN TRUCO"}
local hack = {{'Position', 'Teleport'}, {'Posición', 'Teletransportarse'}}
local toast = {{'Position Hack chosen!', 'Teleport Hack chosen!'},{'¡Posición elegida!', '¡Teletransportado!'}}

function SelectLanguage()
	local menu = gg.choice(lang, nil,'CHOOSE LANGUAGE / ELIGE EL IDIOMA')
	if menu == nil then os.exit() else
    langC = menu
    Main()
  end
end

function Main()
    local menu = gg.choice(hack[langC], nil, selectHack[langC]) 
    if menu == nil then return end
  
    gg.toast(toast[langC][menu])
  
    if menu == 1 then
        -- Position Hack
    elseif menu == 2 then
        -- Teleport Hack
    end
end

while true do 
if gg.isVisible() then
   gg.setVisible(false)
   SelectLanguage()
end
gg.sleep(100)
end
Edited by MonkeySAN
  • 0
Posted

ahh i just realized that i input dot instead of comma xD,
well thankyou for replying, it does work, and im now working on updating all my menu and submenu

thankyou so much my good man

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.