Jump to content
  • -1

Help on Password lua


Devil_Playz_09
 Share

Question

2 answers to this question

Recommended Posts

  • 0

[ @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

---

Link to comment
Share on other sites

  • 0
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 

Edited by Devil_Playz_09
Some changes
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.