Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Author(s): Nettoork#0000
- ]]--
- table.encrypt=function(a,b,c)if not a or not b or not c or type(a)~='table'or b==''or c==''then return end;local d,e,f,g='','','',''for h in b:gmatch('.')do d=d..h:byte()end;for h in c:gmatch('.')do g=g..h:byte()end;math.randomseed(d)otherSeed=math.random(1000000)local i=pcall(function()for h,j in next,a do if type(j)=='string'or type(j)=='number'then if type(j)=='string'then j=[[']]..j..[[']]end;f=f..' '..j..' '..h:upper()else return end end;f=f..' '..g;for h in f:gmatch('.')do local k=h:byte()+68+math.random(5)otherSeed=otherSeed+h:byte()math.randomseed(otherSeed)if k>=65 and k<=122 and not(k>=91 and k<=96)then k=string.char(k)end;e=e..k end end)math.randomseed(os.time())if not i then return else return e end end;table.decrypt=function(l,b,c)if not l or not b or not c or type(l)~='string'or b==''or c==''then return end;local d,e,m,g='','','',''for h in b:gmatch('.')do d=d..h:byte()end;for h in c:gmatch('.')do g=g..h:byte()end;math.randomseed(d)otherSeed=math.random(1000000)local i=pcall(function()for h in l:gmatch('.')do if h:byte()>=65 and h:byte()<=122 then local k=h:byte()-68-math.random(5)otherSeed=otherSeed+k;math.randomseed(otherSeed)e=e..string.char(k)else m=m..h;if m:len()>=3 then local k=tonumber(m)-68-math.random(5)otherSeed=otherSeed+k;math.randomseed(otherSeed)e=e..string.char(k)m=''end end end end)math.randomseed(os.time())if not i then return else local n,o,p,q,r={},0,0;for h,j in string.gmatch(e,'[^%s]+')do p=p+1 end;for h,j in string.gmatch(e,'[^%s]+')do o=o+1;if o==p and h~=g then return elseif q then if q:sub(-1)==[[']]then n[h:lower()]=q:gsub([[']],'')q=nil else q=q..' '..h end elseif r then n[h:lower()]=r;r=nil elseif h:sub(1,1)==[[']]then q=h else r=h end end;return n end end
- local dbPassword, key = 'henin00b<3', 'henim1t0<3' -- Save's password
- local db = {}
- local updateInfo = function(name)
- ui.addTextArea(3, '<font size="16" color="#010101"><p align="center">Collected Cheeses: '..db[name].save.cheese, name, 5, 252, 120, 42, 0xFFFFFF, 1, 0.7, true)
- end
- eventPopupAnswer = function(id, name, answer)
- if id == 2 then
- local gen = table.decrypt(answer, dbPassword, key)
- if gen and tonumber(gen.id) == tfm.get.room.playerList[name].id then
- db[name].save = gen
- updateInfo(name)
- print(name..' uploaded your save successfully!')
- end
- end
- end
- eventTextAreaCallback = function(id, name, callback)
- if callback == 'save' then
- if db[name].timer < os.time() then
- local gen = (table.encrypt(db[name].save, dbPassword, key))
- ui.addPopup(1, 0, 'Save your code in a safe local:\n '..gen, name, 3, 26, 400, 100)
- db[name].timer = os.time() + 5000
- print(('%s generated a new save! %s'):format(name, gen))
- else
- ui.addPopup(1, 0, 'Wait 5 seconds!', name, 3, 26, 400, 100)
- end
- elseif callback == 'load' then
- ui.addPopup(2, 2, 'Put your save', name, 411, 26, 385, 100)
- end
- end
- eventPlayerWon = function(name)
- db[name].save.cheese = db[name].save.cheese + 1
- updateInfo(name)
- end
- eventNewPlayer = function(name)
- db[name] = {
- timer = os.time(),
- save = {
- id = tfm.get.room.playerList[name].id,
- cheese = 0
- }
- }
- ui.addTextArea(1, '<a href="event:save"><D><font size="28"><p align="center">Save', name, 5, 150, 120, 42, 0xFFFFFF, 1, 0.7, true)
- ui.addTextArea(2, '<a href="event:load"><D><font size="28"><p align="center">Load', name, 5, 201, 120, 42, 0xFFFFFF, 1, 0.7, true)
- updateInfo(name)
- end
- table.foreach(tfm.get.room.playerList, eventNewPlayer)
Advertisement
Add Comment
Please, Sign In to add comment