Jump to content
  • 1

Script with autoupdate(online)


Question

Posted

I want to code my script so when i upload a link (like discord attachment) the outdated script will automatically update the script(download the new version or something) can somebody help with that?

Like it is in your script BadCase

@BadCase @CmP @TopGEOYT

Recommended Posts

  • 0
Posted (edited)
12 hours ago, bukandewa said:

Version = tonumber(gg.makeRequest('https://pastebin.com/raw/GgPrZ1t9').content)
--1.1
Script = gg.makeRequest('https://pastebin.com/raw/EheRSRkv').content
--this is example

if Version == 1.2 then
gg.alert('Script is up to date.')
else
Update = gg.alert('New version '..Version..' available.\nClick button below to save the file.', 'Exit', 'Save File')

if not Update then os.exit()
end
if Update == 1 then
os.exit()
end

if Update == 2 then
--file path downloaded file
file = io.open(gg.getFile():gsub('lua', 'downloaded.lua'),'w')
file:write(Script)
file:close()
end
end

Code above just an example version checker and downloader script. You can improve as you need.

I am not recommended to share text file in pastebin, because pastebin didnt have file management.

I think github is good enough for free services. Or if you want to more advance with php, you can try 000webhost.

Can you fix this? Im trying to get this to work but its not working for me

 

OneTap.io.lua

Or here, look at this code

local Onetap = "OneTap.ioTrainer.lua"
local credit = "Script made by skeet-scar from OneTap.io Team\n• FoV Changer\n• No Recoil\n• No Visual Recoil"
local space = "┋S┋c┋r┋i┋p┋t ┋e┋n┋d┋e┋d┋"
local oneTap = "\n🇴‌🇳‌🇪‌🇹‌🇦‌🇵‌.🇮‌🇴‌\n"
local owned = "[[[{{((ХᏔΝᎬᎠ))}}]]]\n"
local internet = "\nyou need an Internet connection to Execute the script\nif you're worried that the script steals data then dont use it!\n\nThe Script needs access to get the Password and Username from Pastebin"
local pastebin = "https://pastebin.com/raw/XWpSxfMn"
user = gg.makeRequest(pastebin).content
if not user then
gg.toast("Couldnt find Username!")
gg.sleep(500)
gg.toast("Couldnt find Keys!")
gg.alert("Something went wrong")
print(space)
print(oneTap)
print(owned)
print(credit)
print(internet)
os.exit()
else
pcall(load(user))
end
key = gg.makeRequest(pastebin).content
if not key then
gg.alert("Something went wrong")
gg.toast("Couldnt find Keys!")
else
pcall(load(key))
end
local login = gg.prompt({
	"User:", 
	"Pass:",
	"Select Download Directory"
	}, {[1] = "Enter Username", [2] = "Enter Password"}, {[1] = "text", [2] = "number",[3]="path"})
if login == nil then
    gg.toast("Exiting script...")
    gg.sleep(500)
    gg.toast("5 seconds Remaining...")
    gg.toast(credit)
    print(credit)
    gg.sleep(5000)
    os.exit()
  end
if login[2]  == key and login[1] == user
  then
    gg.toast('Login Successful') 
    gg.toast("Welcome OneTap.io User!")   
  else 
    gg.alert("The Password you typed in was wrong\n\n[Password you typed in:] "..login[2])
    gg.toast("Exiting script...")
    gg.sleep(500)
    gg.toast("5 seconds Remaining...")
    gg.toast(credit)
    print(credit)
    gg.sleep(5000)
    os.exit()
  end
Version = tonumber(gg.makeRequest("https://pastebin.com/raw/T3bSHeky").content) 
pcall(Version)--1.1
 Script = gg.makeRequest("https://pastebin.com/raw/ETa5RFtG").content
pcall(Script)  --this is example
 if Version == "1.1" then 
 gg.alert('Script is up to date.') 
 else Update =
 gg.alert("New version available.\nClick button below to save the file.", "Exit", "Save File") 
 if not Update then 
 os.exit() end 
 if Update == 1 then os.exit() end 
 if Update == 2 then --file path downloaded file
local file = "/storage/emulated/0/Download"   io.open(gg.getFile():gsub("lua","OneTap.ioVersion1.2")".w")
file:write(Script) 
file:exit() 
  end 
end
if gg.BUILD < 14172 then 
print('You need the latest version of GameGuardian to run this script. Minimum GG v.73.11') 
gg.alert("You need the latest version of GameGuardian to run this script. Minimum GG v.73.11")
print(credit)
os.exit()
end
mbym = 1


if gg.isVisible(true) then
  gg.setVisible(false)
end

local FoVAdd = "E84, 0xff000fff, gg.TYPE_FLOAT" 
local NoRecoilAdd = "CAC, 0xff000fff, gg.TYPE_FLOAT" 
local NoVisualRecoilAdd = "054, 0xfff00fff, gg.TYPE_FLOAT"
local WierdWeaponAdd = "F20, 0xff000fff, gg.TYPE_FLOAT"
local RapidFireAdd = "A88, 0xff000fff, gg.TYPE_FLOAT"
local HighJumpAdd = "FA0, 0xff000fff, gg.TYPE_FLOAT"

function main()
menu = gg.choice({
	"Field of View",
	"No Recoil",
	"No Visual Recoil",
	"Execute UpdatedScript",
	"Exit Trainer"
},nil,"Forward Assault Trainer\nmade by OneTap.io Team")
if menu == 1 then FoVS() end
if menu == 2 then NrcS() end 
if menu == 3 then NVrcS() end
if menu == 4 then Exe() end
if menu == 5 then exit() end 
mbym =-1
end

function Exe()
menu = gg.prompt({
	"Select Script"
},{[1]=login[3]},{[1]="file"},nil)
if menu[1] == nil
  then 
    gg.toast("No Input, Returning to main menu")
  end
if menu == nil
  then
    gg.toast("No Input, Returning to main menu")
    mbym =-1
  end
if menu[1]
  then
   loadfile(menu[1])()
  end
end

function exit()
gg.toast("Exit script...")
print(space)
print(oneTap)
print(owned)
print(credit)
os.exit()
end

function NVrcS()
gg.setRanges(gg.REGION_CODE_APP)
gg.searchAddress("054", 0xff000fff, gg.TYPE_FLOAT)
gg.searchNumber("60", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
local nrc = gg.getResults(2) 
NVrc()
end

function NrcS()
gg.setRanges(gg.REGION_CODE_APP)
gg.searchAddress("CAC", 0xff000fff, gg.TYPE_FLOAT)
gg.searchNumber("60", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
local nrc = gg.getResults(2) 
Nrc()
end

function FoVS()
menu = gg.alert("If you want to change the FoV after you selected something else you need to press on 'Restore', if you're here the first time then press OK", "Restore", "OK")
if menu == 1 then FoVRS() end
if menu == 2 then FoV() end
end

function FoVVS()
gg.setRanges(gg.REGION_CODE_APP)
gg.searchNumber("360", gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
gg.searchAddress("E84", 0xff000fff, gg.TYPE_FLOAT)
gg.getResults(1)
local fov = gg.getResults(1) 
FoV()
end

function FoVRS()
menu = gg.prompt({
	"Input the FoV Value you but when you changed it",
},nil,{"number"})
if menu[1]
  then
    gg.setRanges(gg.REGION_CODE_APP)
    gg.searchNumber(menu[1], gg.TYPE_FLOAT, false, gg.SIGN_EQUAL, 0, -1)
    gg.searchAddress("E84", 0xff000fff, gg.TYPE_FLOAT)
    gg.getResults(1)
    local fov = gg.getResults(1) 
    FoV()
  end
end

function Nrc()
menu = gg.prompt({
	"Activate No Recoil"
},nil,{"checkbox"})
if menu[1]
  then
    local nrcMod = gg.getListItems(nrc)
    gg.getResults(2)
    gg.editAll("0", gg.TYPE_FLOAT)
  end
end

function NVrc()
menu = gg.prompt({
	"Activate No Visual Recoil"
},nil,{"checkbox"})
if menu[1]
  then
    local nrcMod = gg.getListItems(nrc)
    gg.getResults(2)
    gg.editAll("0", gg.TYPE_FLOAT)
  end
end

function FoV()
alert = gg.alert("Save FoV Value First!, press on Save to change the FoV. If you have already changed the FoV Press OK\nif you see this Text Again then press OK", "Save", "OK")
if alert == 1 then FoVVS() end
menu = gg.prompt({
	"Modify FoV [Number between 360 and 150]",
	"Reset FoV"
},nil,{"number", "checkbox"})
if menu[1]
  then
    local fovMod = gg.getListItems(fov)
    gg.getResults(1)
    gg.editAll(menu[1], gg.TYPE_FLOAT)
  end
if menu[2]
  then
    gg.getListItems(fovMod)
    gg.getResults(1)
    gg.editAll("360", gg.TYPE_FLOAT)
    main()
  end
end
--
main()

while true do
    if gg.isVisible(true) then
        gg.setVisible(false)
        mbym = 1
        gg.toast(credit)
    end
    gg.sleep(100)
	if mbym == 1 then
		main()
	end
end

@bukandewa

Edited by YeetMeister
  • 0
Posted
3 minutes ago, noblack said:

Please send the error of the script, i'll be faster to view instead of all of them.

Script ended:
Script error: luaj.LuaError: @/storage/emulated/0/Untitled.lua:70
`local file = "/storage/emulated/0/Download" io.open(gg.getFile():gsub("lua","OneTap.ioVersion1.2")".w")file:write(Script) ...`
attempt to call string
level = 1, pc = 233
stack traceback:
	/storage/emulated/0/Untitled.lua:70 in main chunk
	[Java]: in ?
	at luaj.LuaValue.checkmetatag(LuaValue.java:2895)
	at luaj.LuaValue.callmt(LuaValue.java:2050)
	at luaj.LuaValue.invoke(LuaValue.java:1770)
	at luaj.LuaValue.invokeNotNull(LuaValue.java:3285)
	at luaj.LuaClosure.execute(LuaClosure.java:430)
	at luaj.LuaClosure.call(LuaClosure.java:145)
	at android.ext.Script.runScript(Script.java:5280)
	at android.ext.Script$ScriptThread.run(Script.java:5081)

 

  • 0
  • Administrators
Posted

You post one code in file, another inside code tag in post, and after that show error from third code.

Nobody can help you.

You must show error and attach exact same code from error to post.

31 minutes ago, YeetMeister said:

local file = "/storage/emulated/0/Download" io.open(gg.getFile():gsub("lua","OneTap.ioVersion1.2")".w") file:write(Script) file:exit()

In code above you set variable "file" to string, call io.open without save result to any place. And after that manipulate which variable "file" as it has file handle, but here string, so all die.

I think you want save result from io.open to variable "file".

Also dot before "w" look like error.

  • 0
Posted
Just now, Enyby said:

You post one code in file, another inside code tag in post, and after that show error from third code.

Nobody can help you.

You must show error and attach exact same code from error to post.

In code above you set variable "file" to string, call io.open without save result to any place. And after that manipulate which variable "file" as it has file handle, but here string, so all die.

I think you want save result from io.open to variable "file".

Also dot before "w" look like error.

Before it was withput the dot, i forgot to change it back but still it got error.

So how i save this variable as string, i dont know what you mean

 

I just tried to use an example code but i cant really understand it much

  • 0
  • Administrators
Posted
37 minutes ago, Enyby said:

"/storage/emulated/0/Download"

Remove this part.

In general you need understand what code do. Or you has some stupid errors all time.

  • 0
Posted
13 minutes ago, Enyby said:

Remove this part.

In general you need understand what code do. Or you has some stupid errors all time.

Ohhhhhhhh hsp the file = to io.open..... ok now i feel dumb i thought this is where the file gets saved then....

  • 0
Posted
25 minutes ago, YeetMeister said:

Ohhhhhhhh hsp the file = to io.open..... ok now i feel dumb i thought this is where the file gets saved then....

Now i got it to download the script, but the new file executes with an 2 or more errors

 

@Enyby

  • 0
  • Administrators
Posted
1 minute ago, YeetMeister said:

but the new file executes with an 2 or more errors

 

42 minutes ago, Enyby said:

In general you need understand what code do. Or you has some stupid errors all time.

 

  • 0
Posted
Just now, Enyby said:

 

 

Im sorry, but this whole thing doesnt seem to work well, i fixed the error but when i execute the new script (i believe the old too) then it always shows that an new Update is available even though the version is higher then the pastebin version

Is there any solution

  • 0
  • Administrators
Posted
12 minutes ago, YeetMeister said:

Is there any solution

Of course. Called "debug". Debug your code and fix mistakes. Google about lua.debug. Function "print" is your better friend on that.

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.