Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. -- PARTIE CONFIG --
  2. local MapName = "rp_glife_rockford3" -- Map du serveur
  3. local RestartTime = { 5:00, 11:00, 17:00, 23:00 }-- Heures du reboot
  4. local WarningsReboot = { -- Messages d'avertissement du reboot
  5. "60", -- 60 Minutes
  6. "45", -- 45 Minutes
  7. "30", -- 30 Minutes
  8. "15", -- 15 Minutes
  9. "10", -- 10 Minutes
  10. "5", -- 5 Minutes
  11. "1" -- 1 Minute
  12. }
  13.  
  14. Hav_AutoRestart = {} -- Touche pas à ça
  15.  
  16. -- PARTIE SCRIPT --
  17. timer.Create("Hav_Auto_Restart_Timer", 1, 0, function()
  18. Timestamp = os.time()
  19. TimeString = os.date( "%H:%M" , Timestamp )
  20. Hav_AutoRestart:CheckDay()
  21. end)
  22.  
  23. local warningsdelay = 0
  24. local restartdelay = 0
  25. local PlurielS = ""
  26. function Hav_AutoRestart:CheckDay()
  27. if CurTime() > 60 then
  28. if CurTime() >= warningsdelay then
  29. for k, v in pairs(WarningsReboot) do
  30. local WarningsTime = Timestamp - (60 * 60 * -(v/60))
  31. local WarningsTime = (os.date("%H:%M", WarningsTime))
  32. if tonumber(v) > 1 then PlurielS = "s" else PlurielS = "" end
  33. if RestartTime == WarningsTime then BroadcastLua("chat.AddText(Color(255,60,60), '[Auto Restart] ', Color(255,255,255), 'Le serveur redémarre dans " .. v .. " Minute" .. PlurielS .. ", préparez-vous!' )") warningsdelay = CurTime() + 60 end
  34. end
  35. end
  36.  
  37. if CurTime() >= restartdelay then
  38. if TimeString == RestartTime then
  39. if file.Exists("data/ulx/config.txt", "GAME") then
  40. game.ConsoleCommand("ulx map " .. MapName .. "\n")
  41. else
  42. game.ConsoleCommand("changelevel " .. MapName .. "\n")
  43. end
  44. restartdelay = CurTime() + 60
  45. end
  46. end
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement