Jump to content
  • -1

Help on Password lua


Devil_Playz_09

Question

2 answers to this question

Recommended Posts

Posted

[ @Devil_Playz_09 ]
---
There's 2 variant at one time password:

  • - Per-session: You need to input password first time the script is executed.
  • - Longterm: You need to input password only once, the script will not ask for a password again even after excuted several times.

---
Persession:

keypass = "knx"
prompts = gg.prompt({' 🔑 Password: '},{[1]=''},{[1]='text'})
if prompts[1] == keypass then
	gg.alert("Correct Password")
	menus()
else
	gg.alert("Incorrect Password")
	os.exit()
end
	

---
Longterm: The password is saved on your device.

local keypass = 'knx'
local stores = '.pass/.pwd' 

if not (io.open(gg.EXT_STORAGE .. '/' .. stores, 'r')) then
	input = gg.prompt({' 🔑 Password: '},{[1]=''},{[1]='text'})
	if input[1] == keypass then
		gg.saveList(gg.EXT_STORAGE .. '/' .. stores, gg.LOAD_APPEND)
		io.open(gg.EXT_STORAGE .. '/' .. stores, 'w'):write(keypass) 
		gg.alert('Correct Password')
		menus()
	else
		gg.alert('Wrong Password')
		os.exit()
	end
else
	content = io.open(gg.EXT_STORAGE .. '/' .. stores,'r'):read('*a') 
	if content == keypass then
		gg.alert('Correct Password')
		menus()
	else
		os.remove(gg.EXT_STORAGE .. '/' .. stores) 
		gg.alert('Wrong Password')
		os.exit()
	end
end

function menus()
	...your_hacks_here...
end

---

Posted
5 hours ago, Kiynox said:

[ @Devil_Playz_09 ]
---
There's 2 variant at one time password:

  • - Per-session: You need to input password first time the script is executed.
  • - Longterm: You need to input password only once, the script will not ask for a password again even after excuted several times.

---
Persession:

keypass = "knx"
prompts = gg.prompt({'  Password: '},{[1]=''},{[1]='text'})
if prompts[1] == keypass then
	gg.alert("Correct Password")
	menus()
else
	gg.alert("Incorrect Password")
	os.exit()
end
	

---
Longterm: The password is saved on your device.

local keypass = 'knx'
local stores = '.pass/.pwd' 

if not (io.open(gg.EXT_STORAGE .. '/' .. stores, 'r')) then
	input = gg.prompt({'  Password: '},{[1]=''},{[1]='text'})
	if input[1] == keypass then
		gg.saveList(gg.EXT_STORAGE .. '/' .. stores, gg.LOAD_APPEND)
		io.open(gg.EXT_STORAGE .. '/' .. stores, 'w'):write(keypass) 
		gg.alert('Correct Password')
		menus()
	else
		gg.alert('Wrong Password')
		os.exit()
	end
else
	content = io.open(gg.EXT_STORAGE .. '/' .. stores,'r'):read('*a') 
	if content == keypass then
		gg.alert('Correct Password')
		menus()
	else
		os.remove(gg.EXT_STORAGE .. '/' .. stores) 
		gg.alert('Wrong Password')
		os.exit()
	end
end

function menus()
	...your_hacks_here...
end

---

So if there any chances for the exact same script like in the video it will be helpful to understand lua scripts 

In example when the person put wrong password then it go again to prompt menu and when the person entered wrong password 3 times then the script will toast a wrong password try again in 10 sec

And then it will go again in prompt 

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.