Advertisement
MCFunRide

test

Aug 6th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1.  
  2.  
  3. -- Termination whitelist
  4.  
  5. local admin = {
  6. ["Gonow32"] = true,
  7. ["fun_ride"] = true,
  8. }
  9. os.loadAPI("go")
  10.  
  11. function terminating()
  12. while true do
  13. if event == "terminate" then
  14. term.clear()
  15. term.setCursorPos(1,1)
  16. print("Click the player detector to terminate.")
  17. local evt, player = os.pullEvent("player")
  18. if admins[player] then
  19. say("An admin has terminated CubeBot!")
  20. break
  21. end
  22. break
  23. else
  24. printError("You are not admin!")
  25. say("Warning! "..player.." tried to terminate CubeBot!")
  26. end
  27. end
  28. end
  29. end
  30. function main()
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. print("Gonow32 Personality Set")
  34. function say(str)
  35. s = str:gsub("&","\194\167")
  36. peripheral.find("command").setCommand("say "..s)
  37. peripheral.find("command").runCommand()
  38. end
  39.  
  40. say("Gonow32 Personality Test (&4Cube&bBot&d) online!")
  41. cb = peripheral.find("chatbox")
  42. go.runDispatcher( terminating() )
  43. while true do
  44. local e = {os.pullEvent("chat_message")}
  45. msg = e[4]
  46.  
  47. if msg:sub(1,9) == "CubeBot, " then
  48. if fs.exists("/questions/"..msg:gsub("CubeBot, ","")) then
  49. say(fs.open("/questions/"..msg:gsub("CubeBot, ",""),"r").readAll())
  50. end
  51. end
  52. end
  53.  
  54. local ok, err = pcall( main )
  55.  
  56. if not ok then
  57. say("Oh noes! D: Looks like I had an error!")
  58. say("&c"..err)
  59. f = fs.open("/errorlog","a")
  60. errortime = textutils.formatTime( os.time(), false )
  61. f.writeLine("Error: Time: "..errortime.." Error: "..err)
  62. f.close()
  63. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement