Jump to content
  • 0

How to make one time download only on lua script??


Unnamed1
 Share

Question

Recommended Posts

  • 1

Hi! There's several mistake in Your Script:

  • - If You choose 'Exit' it will execute Menu 2: Which downloading the Script instead of Exitting. The reason is: Choices are Ordered on gg.choice (Call = 1, Exit = 2)
  • - The First Option (Menu 1) doesn't have the same File Location to the File that have been Downloaded (/Dump and /.pass)
  • - The Exec function is Unnecessary since You didn't use them.

I have made 2 Script that has it's Own use:
Temp Script

local file = '/Dump/niggers.lua' --This is Your File location.

menu = gg.choice({"Call File", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	if not (io.open(gg.EXT_STORAGE .. file, 'r')) then --Check if Script is NOT Downloaded
		fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read Script from URL
		if not fileData then --Check if Pastebin is Empty
			print('Site is Down') --Tell User that URL is Invalid
		else
			gg.saveList(gg.EXT_STORAGE .. '/' .. file, gg.LOAD_APPEND) --If Pastebin exist, makes a New Lua File
			fileAppend = io.open(gg.EXT_STORAGE .. file, 'w'):write(fileData) --Save Pastebin Script into the New Lua
			dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
		end
	else
		dofile(gg.EXT_STORAGE .. file)  --Run the Downloaded Script
	end
else
	os.exit() --Exit the Script
end
  • - Choices are now Adjusted: 'Exit' will Exit the script and 'Call File' will runs a simple Directory check.
  • - If the file is NOT Downloaded yet, it will Download the script from Pastebin and Save it into a Directory (/storage/emulated/0/Dump/niggers.lua)
  • - If the file Exist, it will run the Script instead via dofile

Direct Script

menu = gg.choice({"Call Script", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read URL Script
	if not fileData then --Check if URL is  Empty
		print('Site is Down') --Tell User the URL is Invalid
	else
		pcall(load(fileData)) --Run Pastebin Script
	end
else
	os.exit() --Exit the Script
end

This Script does NOT Save the Pastebin Script but instead Run them Directly. This is a good Practice if You do NOT want Your Script to be Stolen from Local Directory.

Edited by MainC
Link to comment
Share on other sites

  • 0
6 minutes ago, HEROGAMEOfficial said:

Use google.drive you can do anything.

Umm i tried it and still pop up the yes or no i need to get rid of it after i actually Downloaded the file in the first place any idea for it really be helpful i cant find any of this topic so might as well ask for help

Link to comment
Share on other sites

  • 0
37 minutes ago, HEROGAMEOfficial said:

Use google.drive you can do anything.

I used google drive still when i press the script it always say du u want internet access i need to remove it after i download the script which i download and still needing to allow it when i already have it any solution how to remove it after i download it and when it detect i dont have the file it will Automatically Pop it up?

Link to comment
Share on other sites

  • 0
3 minutes ago, HEROGAMEOfficial said:

 

Don't use link done problem, load file downloaded

No becouse i wanted it so the user cant go to the file 😞 And automatically run it self after download That what im saying you can see i have dofile in the bottom i need to remove the download after i Downloaded it 

 

Why i need this becouse im doing this for automatically update script thats why thanks if you guys can help 😄 i see a lot of people do this but dont tell me how sadly

Edited by GeorgeMonkey
Link to comment
Share on other sites

  • 0
13 minutes ago, HEROGAMEOfficial said:

Don't save the file and its fix your problem, use load().

... I don't think you know it i dont want the online script i wanted it to just download once then after It will no longer ask and just use dofile(file i just download ) and Like that when theres new update it will Pop up again and after it no longer pop up again its just like in one time password thing but i can make it on an online script download sadly 

 

And i need this becouse after i encrypt the file it will do one time password and when rerun the script it will run the file it downloaded and no inter access required stuff like that

Since it encrypted to

Thanks if you understand if further no understation thanks for helping me anyway but really needing the requirements i really need.

 

Edited by GeorgeMonkey
Link to comment
Share on other sites

  • 0
On 12/15/2022 at 5:59 PM, under_score said:

that is impossible, that menu will always appear if the script needs internet

No it's possible lol

But i can't test it and i need the code to test it even without links i just need the code

On 12/15/2022 at 12:46 PM, Unnamed1 said:

Well I made it download but now i need to Know how to Actually stop the pop up after it completely download since the file already there and ready to execute in the main lua heres the example i wanted to remove Would be helpful if anyone can help thanks!

test = loadfile("the file you want to open")
if not test then 
-- then download 
else
-- then just exit
os.exit()
end

This should work i think 🤔 try it 

This without testing !!!!

Edited by MANDO01
Link to comment
Share on other sites

  • 0
local file = '/Dump/niggers.lua' --This is Your File location.
menu = gg.choice({"Call File", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	if not (io.open(gg.EXT_STORAGE .. file, 'r')) then --Check if Script is NOT Downloaded
		fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read Script from URL
		if not fileData then --Check if Pastebin is Empty
			print('Site is Down') --Tell User that URL is Invalid
		else
			gg.saveList(gg.EXT_STORAGE .. '/' .. file, gg.LOAD_APPEND) --If Pastebin exist, makes a New Lua File
			fileAppend = io.open(gg.EXT_STORAGE .. file, 'w'):write(fileData) --Save Pastebin Script into the New Lua
			dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
		end
	else
		dofile(gg.EXT_STORAGE .. file)  --Run the Downloaded Script
	end
else
	os.exit() --Exit the Script
end

You didn't write

if menu == 2 then os.exit() end

You wrote

else os.exit() end

is that even possible 👀

Link to comment
Share on other sites

  • 0
Quote

You didn't write

if menu == 2 then os.exit() end

You wrote

else os.exit() end

is that even possible 👀

Hi! Yes, It's possible. ELSE will carries any Values other than 1 (On Above Script). You don't need to Specificly define all Condition, Unless You had to do something When 'That' Conditions met.

local switch = 1
if switch == 1 then --Do Something if Condition is 1
	function1()
else if switch == 2 then --Do Something if Condition is 2
	function2()
else --Do Something if Condition is other than 1 and 2 (Accept any value A-Z 0-Infinite)
	function3()
end

This apply accross any language, In fact; checking every Conditions is NOT Recommended in Optimization Perspective even It is supported by ANY Hardware (Computer is basicly a bunch of 0 and 1 Input). Take some Example from Yandere Dev Simulator on How ELSE IF can Affect Performance: Code Review for Yandere Simulator
Some demonstration in other language:

# Good Practice
switch = 1
if switch == 1:
	function1()
elif switch == 2:
	function2()
else:
	function3()

# Bad Practice
if switch == 1:
	function1()
elif switch == 2:
	function2()
elif switch > 2:
	function3()
elif switch 0:
	print('errr')
Edited by MainC
Link to comment
Share on other sites

  • 0
7 hours ago, MainC said:

Hi! Yes, It's possible. ELSE will carries any Values other than 1 (On Above Script). You don't need to Specificly define all Condition, Unless You had to do something When 'That' Conditions met.

local switch = 1
if switch == 1 then --Do Something if Condition is 1
	function1()
else if switch == 2 then --Do Something if Condition is 2
	function2()
else --Do Something if Condition is other than 1 and 2 (Accept any value A-Z 0-Infinite)
	function3()
end

This apply accross any language, In fact; checking every Conditions is NOT Recommended in Optimization Perspective even It is supported by ANY Hardware (Computer is basicly a bunch of 0 and 1 Input). Take some Example from Yandere Dev Simulator on How ELSE IF can Affect Performance: Code Review for Yandere Simulator
Some demonstration in other language:

# Good Practice
switch = 1
if switch == 1:
	function1()
elif switch == 2:
	function2()
else:
	function3()

# Bad Practice
if switch == 1:
	function1()
elif switch == 2:
	function2()
elif switch > 2:
	function(3)
elif switch 0:
	print('errr')

Cool I know it's in other languages but i didn't know it's in lua

Link to comment
Share on other sites

  • 0
On 12/18/2022 at 2:18 AM, MANDO01 said:

No it's possible lol

But i can't test it and i need the code to test it even without links i just need the code

test = loadfile("the file you want to open")
if not test then 
-- then download 
else
-- then just exit
os.exit()
end

This should work i think 🤔 try it 

This without testing !!!!

Thanks for the help this what exactly im looking for 😄

On 12/18/2022 at 3:27 PM, MainC said:

Hi! There's several mistake in Your Script:

  • - If You choose 'Exit' it will execute Menu 2: Which downloading the Script instead of Exitting. The reason is: Choices are Ordered on gg.choice (Call = 1, Exit = 2)
  • - The First Option (Menu 1) doesn't have the same File Location to the File that have been Downloaded (/Dump and /.pass)
  • - The Exec function is Unnecessary since You didn't use them.

I have made 2 Script that has it's Own use:
Temp Script

local file = '/Dump/niggers.lua' --This is Your File location.

menu = gg.choice({"Call File", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	if not (io.open(gg.EXT_STORAGE .. file, 'r')) then --Check if Script is NOT Downloaded
		fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read Script from URL
		if not fileData then --Check if Pastebin is Empty
			print('Site is Down') --Tell User that URL is Invalid
		else
			gg.saveList(gg.EXT_STORAGE .. '/' .. file, gg.LOAD_APPEND) --If Pastebin exist, makes a New Lua File
			fileAppend = io.open(gg.EXT_STORAGE .. file, 'w'):write(fileData) --Save Pastebin Script into the New Lua
			dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
		end
	else
		dofile(gg.EXT_STORAGE .. file)  --Run the Downloaded Script
	end
else
	os.exit() --Exit the Script
end
  • - Choices are now Adjusted: 'Exit' will Exit the script and 'Call File' will runs a simple Directory check.
  • - If the file is NOT Downloaded yet, it will Download the script from Pastebin and Save it into a Directory (/storage/emulated/0/Dump/niggers.lua)
  • - If the file Exist, it will run the Script instead via dofile

Direct Script

menu = gg.choice({"Call Script", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read URL Script
	if not fileData then --Check if URL is  Empty
		print('Site is Down') --Tell User the URL is Invalid
	else
		pcall(load(fileData)) --Run Pastebin Script
	end
else
	os.exit() --Exit the Script
end

This Script does NOT Save the Pastebin Script but instead Run them Directly. This is a good Practice if You do NOT want Your Script to be Stolen from Local Directory.

Yes Indeed This what im saying thanks for the people who understands!!

Link to comment
Share on other sites

  • 0
On 12/18/2022 at 3:27 PM, MainC said:

Hi! There's several mistake in Your Script:

  • - If You choose 'Exit' it will execute Menu 2: Which downloading the Script instead of Exitting. The reason is: Choices are Ordered on gg.choice (Call = 1, Exit = 2)
  • - The First Option (Menu 1) doesn't have the same File Location to the File that have been Downloaded (/Dump and /.pass)
  • - The Exec function is Unnecessary since You didn't use them.

I have made 2 Script that has it's Own use:
Temp Script

local file = '/Dump/niggers.lua' --This is Your File location.

menu = gg.choice({"Call File", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	if not (io.open(gg.EXT_STORAGE .. file, 'r')) then --Check if Script is NOT Downloaded
		fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read Script from URL
		if not fileData then --Check if Pastebin is Empty
			print('Site is Down') --Tell User that URL is Invalid
		else
			gg.saveList(gg.EXT_STORAGE .. '/' .. file, gg.LOAD_APPEND) --If Pastebin exist, makes a New Lua File
			fileAppend = io.open(gg.EXT_STORAGE .. file, 'w'):write(fileData) --Save Pastebin Script into the New Lua
			dofile(gg.EXT_STORAGE .. file) --Run the Downloaded Script
		end
	else
		dofile(gg.EXT_STORAGE .. file)  --Run the Downloaded Script
	end
else
	os.exit() --Exit the Script
end
  • - Choices are now Adjusted: 'Exit' will Exit the script and 'Call File' will runs a simple Directory check.
  • - If the file is NOT Downloaded yet, it will Download the script from Pastebin and Save it into a Directory (/storage/emulated/0/Dump/niggers.lua)
  • - If the file Exist, it will run the Script instead via dofile

Direct Script

menu = gg.choice({"Call Script", "Exit"}, nil, "Main") --Ordered Choice (Call = 1, Exit = 2)
if menu == 1 then --Check if User chooce 'Call'
	fileData = gg.makeRequest('https://pastebin.com/raw/hNhEbgVd').content --Read URL Script
	if not fileData then --Check if URL is  Empty
		print('Site is Down') --Tell User the URL is Invalid
	else
		pcall(load(fileData)) --Run Pastebin Script
	end
else
	os.exit() --Exit the Script
end

This Script does NOT Save the Pastebin Script but instead Run them Directly. This is a good Practice if You do NOT want Your Script to be Stolen from Local Directory.

Yes Thanks! I thought no one understands my request thank you so much!

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.