Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local users = {
- ["Shane"] = 1,
- ["Epuuc"] = 1,
- ["Callym"] = 2,
- ["SalsaChips_"] = 2,
- ["Nathan"] = 3,
- ["hatman543211"] = 3,
- ["Phoenix"] = 4,
- ["BallaSteve"] = 4,
- ["Kai"] = 5,
- ["INSERTKAIUSERNAME"] = 5,
- ["AJ"] = 6,
- ["Dogmatix2008"] = 6,
- ["Evan"] = 7,
- ["DessiForm"] = 7,
- ["Jordan"] = 8,
- ["coolkid7103"] = 8,
- }
- local function setFileContents(filename,content)
- if not fs.exists("/data") then
- print("data doesn't exist")
- fs.makeDir("/data")
- end
- if not content or content == "" then
- fs.delete("/data/"..filename)
- return
- end
- local file = fs.open("/data/"..filename,"w")
- file.write(content)
- file.close()
- return true
- end
- local function getFileContents(filename)
- if not fs.exists("/data") or not fs.exists("/data/"..filename) then return false end
- local file = fs.open("/data/"..filename,"r")
- local content = file.readAll()
- file.close()
- return content
- end
- if not args[1] then print("arg 1 missing or nil") return end
- if args[1] == "set" and not args[2] then print("arg 2 missing or nil") return end
- if args[1]:lower() == "get" then
- if getFileContents("owner") and getFileContents("owner") ~= "" then
- print(getFileContents("owner"),"is the owner of this computer")
- else
- print("There is no owner for this computer")
- end
- end
- if args[1]:lower() == "set" then
- local nameid = users[args[2]]
- if not nameid then nameid = 9 end
- setFileContents("owner",args[2].."_"..nameid)
- print("Owner set to:",args[2].."_"..nameid)
- end
Add Comment
Please, Sign In to add comment