Jump to content

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

8 answers to this question

Recommended Posts

  • 1
Posted

yup..yours are working.

but i will do like this :

local lang = {' English',' Español'}
local selectHack = {"ONLY SELECT ONE HACK", "ELIGE SOLO UN TRUCO"}
local hack = {{'Position', 'Teleport'}, {'Posición', 'Teletransportarse'}}
local teleporthack = {{'Map 1', 'Map 2'}, {'Mapa 1', 'Mapa 2'}}
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
    	TeleportHack()
    end
end

function TeleportHack()
    local hackName = hack[langC][2]
    local menuTitle = hackName.." - "..selectHack[langC]
    local menu = gg.choice(teleporthack[langC], nil, menuTitle) 
    if menu == nil then return end
    if menu == 1 then
        -- Map 1
    elseif menu == 2 then
        -- Map 2
    end
end

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

 

  • 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
  • 1
Posted
On 6/16/2025 at 7:11 AM, chandelier said:

 

 

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 just wanted to point out that it looks like this script will call SelectLanguage() whenever gameguardian is clicked. That works, but it doesn't make sense to select the language more than once. It is much more logical to select the language once, then directly call Main() after that:

 

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

 

  • 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

  • 0
Posted
On 6/18/2025 at 7:30 PM, HorridModz said:

I just wanted to point out that it looks like this script will call SelectLanguage() whenever gameguardian is clicked. That works, but it doesn't make sense to select the language more than once. It is much more logical to select the language once, then directly call Main() after that:

 

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

 

ahh now you mentioned it xD thanks for pointing that out, yepp it does look more decent if i do that

  • 0
Posted (edited)

sorry if i reopen this rather than making new help topic, it should have been solved the other day but,
i need help again regarding this help topic and want to add something on my menu.

how do i add current chosen menu text from local hack table to gg.choice in the function TeleportHack()?

local lang = {' English',' Español'}
local selectHack = {"ONLY SELECT ONE HACK", "ELIGE SOLO UN TRUCO"}
local hack = {{'Position', 'Teleport'}, {'Posición', 'Teletransportarse'}}
local teleporthack = {{'Map 1', 'Map 2'}, {'Mapa 1', 'Mapa 2'}}
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
       TeleportHack()
    end
end

function TeleportHack()
    local menu = gg.choice(teleporthack[langC], nil, hack[langC][menu].."\n"..selectHack[langC]) 
    if menu == nil then return end
    if menu == 1 then
        -- Map 1
    elseif menu == 2 then
        -- Map 2
    end
end

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

I've tried code above but i got this error.
attempt to concatenate a nil value (field'?')

Edited by chandelier
  • 0
Posted

ah i found the solution but idk if i can make it more efficient,

local lang = {' English',' Español'}
local selectHack = {"ONLY SELECT ONE HACK", "ELIGE SOLO UN TRUCO"}
local hack = {{'Position', 'Teleport'}, {'Posición', 'Teletransportarse'}}
local teleporthack = {{'Map 1', 'Map 2'}, {'Mapa 1', 'Mapa 2'}}
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
    	menutext = menu
    elseif menu == 2 then
    	TeleportHack()
    	menutext = menu
    end
end

function TeleportHack()
    local menu = gg.choice(teleporthack[langC], nil, tostring(hack[langC][menutext]).."\n"..selectHack[langC]) 
    if menu == nil then return end
    if menu == 1 then
        -- Map 1
    elseif menu == 2 then
        -- Map 2
    end
end

gg.setVisible(false)
SelectLanguage()
while true do 
if gg.isVisible() then
   gg.setVisible(false)
   Main()
end
gg.sleep(100)
end
  • 0
Posted
13 hours ago, MonkeySAN said:

yup..yours are working.

but i will do like this :

local lang = {' English',' Español'}
local selectHack = {"ONLY SELECT ONE HACK", "ELIGE SOLO UN TRUCO"}
local hack = {{'Position', 'Teleport'}, {'Posición', 'Teletransportarse'}}
local teleporthack = {{'Map 1', 'Map 2'}, {'Mapa 1', 'Mapa 2'}}
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
    	TeleportHack()
    end
end

function TeleportHack()
    local hackName = hack[langC][2]
    local menuTitle = hackName.." - "..selectHack[langC]
    local menu = gg.choice(teleporthack[langC], nil, menuTitle) 
    if menu == nil then return end
    if menu == 1 then
        -- Map 1
    elseif menu == 2 then
        -- Map 2
    end
end

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

 

as always, yours are better xD
it fixed some problem when im using mine

anyway thankyou so muchhhh

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.