Advertisement
Derek1017

Admin

Mar 1st, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. ----------------------------------------------------------------------------------------
  2. -- Epix Inc. Server Suite --
  3. ----------------------------------------------------------------------------------------
  4. -- Epix Incorporated. Not Everything is so Black and White. --
  5. ----------------------------------------------------------------------------------------
  6.  
  7. local set=require(script.Settings) --This is where to grab settings from.
  8.  
  9. --Settings can be found in the Settings ModuleScript parented to this!
  10. --http://prntscr.com/5n9fv5
  11. --[[
  12. --__________________________________________________________________________________--
  13. --__________________________________________________________________________________--
  14. --__________________________________________________________________________________--
  15. --__________________________________________________________________________________--
  16. -- --
  17.  
  18. ___________ .__ .___
  19. \_ _____/_____ |__|__ ___ | | ____ ____
  20. | __)_\____ \| \ \/ / | |/ \_/ ___\
  21. | \ |_> > |> < | | | \ \___
  22. /_______ / __/|__/__/\_ \ |___|___| /\___ > /\
  23. \/|__| \/ \/ \/ \/
  24. --------------------------------------------------------
  25. Epix Incorporated. Not Everything is so Black and White.
  26. --------------------------------------------------------
  27.  
  28.  
  29. _ __ _ _ _ _
  30. | |/ /___| | |_ __ _ __| |_ _ _ ___ _ __| |_ ___
  31. | ' </ _ \ | _/ _` (_-< _| '_/ _ \ '_ \ ' \/ -_)
  32. |_|\_\___/_|\__\__,_/__/\__|_| \___/ .__/_||_\___|
  33. |_|
  34. ______ ______ ______ __ ______ ______ ______ ______ __ ______
  35. /\ ___\/\ ___\/\ ___\/\ \ /\ ___\/\ == \/\ __ \/\__ _/\ \/\ ___\
  36. \ \___ \ \ \___\ \ __\\ \ \___\ \ __\\ \ __<\ \ __ \/_/\ \\ \ \ \___ \
  37. \/\_____\ \_____\ \_____\ \_____\ \_____\ \_\ \_\ \_\ \_\ \ \_\\ \_\/\_____\
  38. \/_____/\/_____/\/_____/\/_____/\/_____/\/_/ /_/\/_/\/_/ \/_/ \/_/\/_____/
  39.  
  40.  
  41. --__________________________________________________________________________________--
  42. --__________________________________________________________________________________-- --
  43. --__________________________________________________________________________________--
  44. --__________________________________________________________________________________--
  45. -- -- ]]
  46.  
  47. --------------------------------------------------------------------------------------
  48. --##################################################################################--
  49.  
  50. --##[ WARNING: Changing anything below could result errors and break the script! ]##--
  51.  
  52. --##################################################################################--
  53.  
  54. --#############[ DO NOT MODIFY UNLESS YOU KNOW WHAT YOU ARE DOING! ]################--
  55.  
  56. --#################[ I WILL NOT HELP YOU IF YOU BREAK SOMETHING! ]##################--
  57.  
  58. --##################################################################################--
  59. --------------------------------------------------------------------------------------
  60.  
  61. --__________________________________________________________________________________--
  62. --__________________________________________________________________________________-- --
  63. --__________________________________________________________________________________--
  64. --__________________________________________________________________________________--
  65. -- -- --
  66. set.Debug=false --//DEBUG
  67.  
  68. --[ Check for Updates ]--
  69. function MainScriptFunction()
  70. if not set.Debug then
  71. script.Parent=game:service('ServerScriptService')
  72. end
  73. local updateCode=script:FindFirstChild("UPDATE_CODE_")
  74. if (updateCode and _G[updateCode.Value]) or _G['Epix Inc. Server Suite Update'] then
  75. local updateTable=_G['Epix Inc. Server Suite Update']
  76. if updateCode then
  77. updateTable=_G[updateCode.Value]
  78. end
  79. local updated,failed=ypcall(function()
  80. print('AutoUpdate: Grabbing update data...')
  81. for i,v in pairs(updateTable) do set[i]=v updateTable[i]=nil end
  82. _G['Epix Inc. Server Suite Update']=nil
  83. if updateCode then
  84. _G[updateCode.Value]=nil
  85. updateCode:Destroy()
  86. end
  87. end)
  88. if failed then
  89. print(script.Name..': AutoUpdate: Update Failed.')
  90. print('Please contact Sceleratis as this may be a bug.')
  91. print('Error: '..failed)
  92. print('If this error persist please check your settings. If needed disable AutoUpdate until the issue is solved.')
  93. end
  94. end
  95. local Plugins={}
  96. for i,v in pairs(script['Plugins']:children()) do
  97. table.insert(Plugins,v)
  98. end
  99. if set.Debug then
  100. print("~=! DEBUG MODE !=~")
  101. set.HelpGui=false
  102. require(script.Parent:FindFirstChild("MainModule"))(set,Plugins)
  103. else
  104. require(set.MainModuleID)(set,Plugins)
  105. end
  106. end
  107.  
  108. set.RunTheScript=function()
  109. local yes,no=ypcall(MainScriptFunction)
  110. if no then
  111. local h=Instance.new('Hint',workspace)
  112. h.Text=no print(no)
  113. end
  114. end
  115. local ok,no=ypcall(function() local k=game:GetService('InsertService'):LoadAsset(set.LoaderID) if k then k:Destroy() end end)
  116. if set['AutoUpdate'] and ok then
  117. local k,n=ypcall(function()
  118. local news=game:GetService('InsertService'):LoadAsset(set.LoaderID):children()[1]
  119. local found=news.Version.Value
  120. local current=script.Version.Value
  121. print('Current version: '..current..' | Found version: '..found)
  122. if found>current then
  123. print('Updating...')
  124. local updateCode = Instance.new("StringValue",news)
  125. updateCode.Name="UPDATE_CODE_"
  126. updateCode.Value=math.random()..math.random()
  127. _G[updateCode.Value]=set
  128. news['Plugins']:Destroy()
  129. script['Plugins']:clone().Parent=news
  130. news.Parent=game:service('ServerScriptService')
  131. script:Destroy()
  132. else
  133. news:Destroy()
  134. set.RunTheScript()
  135. end
  136. end)
  137. if not k or n then
  138. print('AutoUpdate Broke: '..n..' | Skipping update')
  139. set.RunTheScript()
  140. end
  141. else
  142. print("AutoUpdate is Disabled")
  143. set.RunTheScript()
  144. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement