Jump to content
  • -4

How can i make my script works only one time?


_insidious
 Share

Question

13 answers to this question

Recommended Posts

  • 0

What's the point of "auto-destruction" of the file that is executed, if it can be simply backed up before executing it?

There are no ways (without using server) to prevent script from being executed more than one time that couldn't be easily bypassed, but if you still need to have that for some reason, basic approach is to check presence of certain file and only continue execution if the file is not present and to create that file right after the check has been passed.

Link to comment
Share on other sites

  • 0
14 hours ago, _insidious said:

i wanna make that my script works only one time so at exit the script will be autodestroyed is it possible?

You can save a file in the device if this file exists delete the script if it's not the execute it

You just need a good place to hide this file

 

 

Edited by MANDO01
Link to comment
Share on other sites

  • 0
Just now, MANDO01 said:

You just need a good place to hide this file

 

no way, this is easy to bypass, someone can just use a file manager that that list recently created file, or just list everything by date, and got it

Link to comment
Share on other sites

  • 0
1 hour ago, MAARS said:

no way, this is easy to bypass, someone can just use a file manager that that list recently created file, or just list everything by date, and got it

You can put this file in an root 😐 or in the system or in the game data for example 

Link to comment
Share on other sites

  • 0
3 hours ago, MANDO01 said:

You can put this file in an root 😐 or in the system or in the game data for example 

storing another file is the most useless thing to even suggest, i need the script will get autodestroyed after use

Link to comment
Share on other sites

  • 0
58 minutes ago, _insidious said:

storing another file is the most useless thing to even suggest, i need the script will get autodestroyed after use

Save a file when the script executed for the first time and if this file exists make the script delete himself so even if he saved a backup it will delete himself when execute

Link to comment
Share on other sites

  • 0
17 hours ago, MANDO01 said:

Save a file when the script executed for the first time and if this file exists make the script delete himself so even if he saved a backup it will delete himself when execute

That unnecessary, you can delete it right away on the execution, cause when you execute a script, it will be loaded in the memory, and the file source code is no longer needed until next execution 

21 hours ago, MANDO01 said:

You can put this file in an root 😐 or in the system or in the game data for example 

Not everyone has root privilege, and just like the /root, game data folder is no longer accessible without root on recent android version 10+

Edited by MAARS
Link to comment
Share on other sites

  • 0
17 hours ago, MAARS said:

That unnecessary, you can delete it right away on the execution, cause when you execute a script, it will be loaded in the memory, and the file source code is no longer needed until next execution 

Not everyone has root privilege, and just like the /root, game data folder is no longer accessible without root on recent android version 10+

Okay your right do you have another solution 😄

Link to comment
Share on other sites

  • 0

Just put this on top of your script, the problem here will be that if the user is aware than you script self destruct, he can just make copies and execute the copies each time
 

local f_name  = gg.getFile():match("^.+/(.+)$")
local nf_name = math.random(10 ^ 9, 10 ^ 10 - 1) .. ".lua"

os.rename(f_name, nf_name)
os.remove(nf_name)

-- Your code start bellow here
gg.alert("I have deleted myself.")

 

Link to comment
Share on other sites

  • 0
7 hours ago, MAARS said:

Just put this on top of your script, the problem here will be that if the user is aware than you script self destruct, he can just make copies and execute the copies each time
 

local f_name  = gg.getFile():match("^.+/(.+)$")
local nf_name = math.random(10 ^ 9, 10 ^ 10 - 1) .. ".lua"

os.rename(f_name, nf_name)
os.remove(nf_name)

-- Your code start bellow here
gg.alert("I have deleted myself.")

 

And this why I said to store file 😄

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.