Epuuc

Minecraft CC (ALL) Owner (set:get)w

Nov 22nd, 2020 (edited)
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. local args = {...}
  2. local users = {
  3. ["Shane"] = 1,
  4. ["Epuuc"] = 1,
  5. ["Callym"] = 2,
  6. ["SalsaChips_"] = 2,
  7. ["Nathan"] = 3,
  8. ["hatman543211"] = 3,
  9. ["Phoenix"] = 4,
  10. ["BallaSteve"] = 4,
  11. ["Kai"] = 5,
  12. ["INSERTKAIUSERNAME"] = 5,
  13. ["AJ"] = 6,
  14. ["Dogmatix2008"] = 6,
  15. ["Evan"] = 7,
  16. ["DessiForm"] = 7,
  17. ["Jordan"] = 8,
  18. ["coolkid7103"] = 8,
  19. }
  20. local function setFileContents(filename,content)
  21.     if not fs.exists("/data") then
  22.         print("data doesn't exist")
  23.         fs.makeDir("/data")
  24.     end
  25.     if not content or content == "" then
  26.         fs.delete("/data/"..filename)
  27.         return
  28.     end
  29.     local file = fs.open("/data/"..filename,"w")
  30.     file.write(content)
  31.     file.close()
  32.     return true
  33. end
  34. local function getFileContents(filename)
  35.     if not fs.exists("/data") or not fs.exists("/data/"..filename) then return false end
  36.     local file = fs.open("/data/"..filename,"r")
  37.     local content = file.readAll()
  38.     file.close()
  39.     return content
  40. end
  41.  
  42. if not args[1] then print("arg 1 missing or nil") return end
  43. if args[1] == "set" and not args[2] then print("arg 2 missing or nil") return end
  44. if args[1]:lower() == "get" then
  45.     if getFileContents("owner") and getFileContents("owner") ~= "" then
  46.         print(getFileContents("owner"),"is the owner of this computer")
  47.     else
  48.         print("There is no owner for this computer")
  49.     end
  50. end
  51. if args[1]:lower() == "set" then
  52.     local nameid = users[args[2]]
  53.     if not nameid then nameid = 9 end
  54.     setFileContents("owner",args[2].."_"..nameid)
  55.     print("Owner set to:",args[2].."_"..nameid)
  56. end
  57.  
  58.  
  59.  
Add Comment
Please, Sign In to add comment