Advertisement
djshadowxm81

ccServerTime

Mar 4th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function serverTime()  
  2.        
  3. --Server to pull time from
  4. http.request("http://mc.ov-gaming.com/cc/time.php")
  5.  
  6. local requesting = true
  7.  
  8.     while requesting do
  9.       local event, url, sourceText = os.pullEvent()
  10.       local respondedText = sourceText.readAll()
  11.       if event == "http_success" then
  12.        
  13.        
  14.         sourceText.close()
  15.         --Print the reply if successful;  debug info for now
  16.         --print("Reply was: " .. respondedText)
  17.        
  18.  
  19.         requesting = false
  20.       elseif event == "http_failure" then
  21.         print("Server didn't respond.")
  22.        
  23.         requesting = false
  24.       end
  25.      return(respondedText)
  26.      end
  27. end
  28.  
  29. print(serverTime())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement