ACheats

uverenosti

Jan 13th, 2021 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.78 KB | None | 0 0
  1. local caller = getScriptCaller()
  2. local allData = getAllUserData()
  3.  
  4. -- getLocalData(string), setLocalData(string, value)
  5.  
  6. isUserReg = getLocalData('Diplom_Tema' .. caller.id)
  7. isUserHasMentor = getLocalData('Diplom_Mentor' .. caller.id)
  8.  
  9. diplomExample = "Вы не выбрали тему дипломки.\n Выберите тему !!diplom тема [название темы]\nПримеры тем: \n1) Виды крашеров и защита от них\n2) Актуальность Lua в 2022 \n3) Современные методы разработки плагинов для SAMPFUNCS\n4) Разработка автоматизированного бота для шахты Advance RP \n5) Разработка информационной системы для кладов Arizona RP"
  10. cmdsList = "Список команд:\n!!diplom тема [название]\n!!diplom руководитель [ник]\n!!diplom статус\n!!diplom [текст диплома]\n!!diplom читать"
  11.  
  12.  
  13.  
  14.  
  15. function checkTime()
  16. local time = getLocalData('Diplom_Delay' .. caller.id)
  17. if not time then
  18. setLocalData('Diplom_Delay' .. caller.id, os.time())
  19. return false
  20. end
  21. if os.time() - tonumber(time) > 24*60*60 then
  22. setLocalData('Diplom_Delay' .. caller.id, os.time())
  23. return false
  24. end
  25. return true
  26. end
  27.  
  28.  
  29.  
  30. function setTema(params)
  31. if not params then return "Введите действительную тему дипломки." end
  32. if getLocalData('Diplom_Tema' .. caller.id) then return "Тему изменить нельзя" end
  33. setLocalData('Diplom_Tema' .. caller.id, params)
  34. setLocalData('Diplom_Tema_date' .. caller.id, os.date("%d %B %Y %X"))
  35. setLocalData('Diplom_Status' .. caller.id, 0)
  36. cuprins = "Тема: " .. params .. "\nАвтор: " .. caller.username .. "\n"
  37. setLocalData('Diplom_Text' .. caller.id, cuprins)
  38. return "Тема: " .. params .. "\nДата: " .. os.date("%d %B %Y %X") .. "\nСтудент: " .. caller.username or "Ноунейм" .. "\nДанные были отправлены в деканат.\n*Выберите научного руководителя: !!diplom руководитель [ник руководителя]"
  39. end
  40.  
  41. function setMentor(params)
  42. if not isUserReg then return diplomExample end
  43. if not params then return "Введите ник руководителя." end
  44. if getLocalData('Diplom_Mentor' .. caller.id) then return "Нельзя менять руководителя" end
  45. setLocalData('Diplom_Mentor' .. caller.id, params)
  46. return "Тема: " .. getLocalData('Diplom_Tema' .. caller.id) .. "\nДата: " .. getLocalData('Diplom_Tema_date' .. caller.id) .. "\nСтудент: " .. caller.username .. "\nНаучный руководитель: " .. params
  47. end
  48.  
  49. function getStatus(params)
  50. if not isUserReg then return diplomExample end
  51. if not isUserHasMentor then return "Вы не выбрали научного руководителя.\n !!diplom руководитель [ник руководителя]" end
  52. return "В разработке."
  53. end
  54.  
  55. function writeDiplom(text)
  56. if not isUserReg then return diplomExample end
  57. if not isUserHasMentor then return "Вы не выбрали научного руководителя.\n !!diplom руководитель [ник руководителя]" end
  58. if not text then return "Харош лить воду в диплом." end
  59. if checkTime() then return os.date("Вы уже писали дипломку. Возвращайтесь через %H часов %M минут *t", os.difftime(tonumber(getLocalData('Diplom_Delay' .. caller.id)))+24*60*60, os.time()) - 1 ) end
  60. diplomText = getLocalData('Diplom_Text' .. caller.id)
  61. setLocalData('Diplom_Text' .. caller.id, diplomText .. "\n" .. text)
  62. return "Вы вписали в дипломную работу: " .. text
  63. end
  64.  
  65. function readDiplom()
  66. if not isUserReg then return diplomExample end
  67. if not isUserHasMentor then return "Вы не выбрали научного руководителя.\n !!diplom руководитель [ник руководителя]" end
  68. return getLocalData('Diplom_Text' .. caller.id)
  69. end
  70.  
  71. function helpDiplom()
  72. return cmdsList
  73. end
  74.  
  75.  
  76. function deleteDiplom()
  77. setLocalData('Diplom_Tema' .. caller.id, nil)
  78. setLocalData('Diplom_Tema_date' .. caller.id, nil)
  79. setLocalData('Diplom_Status' .. caller.id, nil)
  80. setLocalData('Diplom_Text' .. caller.id, nil)
  81. setLocalData('Diplom_Mentor' .. caller.id, nil)
  82. setLocalData('Diplom_Delay' .. caller.id, nil)
  83. return "Вся информация была удалена из деканата."
  84. end
  85.  
  86. function debuger(params)
  87. return getLocalData(params .. caller.id)
  88. end
  89.  
  90. function set(params)
  91. return setLocalData("Diplom_Delay" .. caller.id, params)
  92. end
  93.  
  94. function topDiplom()
  95. return "В разработке."
  96. end
  97.  
  98. function serve(action, params)
  99. if action == "тема" then return setTema(params) end
  100. if action == "руководитель" then return setMentor(params) end
  101. if action == "debug" then return debuger(params) end
  102. if action == "set" then return set(params) end
  103. return writeDiplom(action .. params)
  104. end
  105.  
  106. function call(action)
  107. if action == "статус" then return getStatus() end
  108. if action == "читать" then return readDiplom() end
  109. if action == "помощь" then return helpDiplom() end
  110. if action == "бросить" then return deleteDiplom() end
  111. if action == "топ" then return topDiplom() end
  112. return writeDiplom(action)
  113. end
  114.  
  115. if _ARGS then
  116. local index = string.find(_ARGS, ' ')
  117.  
  118. if index then
  119. action = string.sub(_ARGS, 1, index - 1)
  120. params = string.sub(_ARGS, index + 1)
  121. return serve(action, params)
  122. else
  123. action = _ARGS
  124. return call(action)
  125. end
  126. end
  127.  
  128. return cmdsList
Add Comment
Please, Sign In to add comment