Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1.  
  2. ESX = nil
  3.  
  4. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  5.  
  6. ESX.RegisterServerCallback('esx_marker:getUsergroup', function(source, cb)
  7. local xPlayer = ESX.GetPlayerFromId(source)
  8. local group = xPlayer.getGroup()
  9. cb(group)
  10. end)
  11. --[[
  12. Citizen.CreateThread(function()
  13. Citizen.Wait(1000)
  14. print('^7[^8MYTHIC_BASE ^7: ^8Startup^0] ^5Registering Admin Sync Commands^7')
  15.  
  16. exports['mythic_chat']:AddAdminChatCommand('freeze', function(source, args, rawCommand)
  17. if args[1]:lower() == 'weather' or args[1]:lower() == 'time' then
  18. FreezeElement(args[1])
  19. else
  20. TriggerEvent('mythic_chat:server:Server', source, 'Invalid Argument')
  21. end
  22. end, {
  23. help = 'Freeze Weather or Time',
  24. params = {{
  25. name = 'Type',
  26. help = 'Weather or Time'
  27. }
  28. }
  29. }, 1)
  30.  
  31. exports['mythic_chat']:AddAdminChatCommand('weather', function(source, args, rawCommand)
  32. for _, v in pairs(AvailableWeatherTypes) do
  33. if args[1]:upper() == v then
  34. SetWeather(args[1])
  35. return
  36. end
  37. end
  38. TriggerEvent('mythic_chat:server:Server', source, 'Invalid Argument')
  39. end, {
  40. help = 'Set Weather',
  41. params = {{
  42. name = 'Type',
  43. help = 'EXTRASUNNY, CLEAR, NEUTRAL, SMOG, FOGGY, OVERCAST, CLOUDS, CLEARING, RAIN, THUNDER, SNOW, BLIZZARD, SNOWLIGHT, XMAS, HALLOWEEN'
  44. }
  45. }
  46. }, 1)
  47.  
  48. exports['mythic_chat']:AddAdminChatCommand('time', function(source, args, rawCommand)
  49. for _, v in pairs(AvailableTimeTypes) do
  50. if args[1]:upper() == v then
  51. SetTime(args[1])
  52. return
  53. end
  54. end
  55. TriggerEvent('mythic_chat:server:Server', source, 'Invalid Argument')
  56. end, {
  57. help = 'Set Time',
  58. params = {{
  59. name = 'Type',
  60. help = 'MORNING, NOON, EVENING, NIGHT'
  61. }
  62. }
  63. }, 1)
  64.  
  65. exports['mythic_chat']:AddAdminChatCommand('clock', function(source, args, rawCommand)
  66. if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
  67. SetExactTime(args[1], args[2])
  68. else
  69. TriggerEvent('mythic_chat:server:Server', source, 'Invalid Argument')
  70. end
  71. end, {
  72. help = 'Set Time To An Exact Hour & Minute',
  73. params = {{
  74. name = 'Hour',
  75. help = 'Number Between 0 - 23'
  76. },
  77. {
  78. name = 'Minute',
  79. help = 'Number Between 0 - 59'
  80. }
  81. }
  82. }, 2)
  83.  
  84. exports['mythic_chat']:AddAdminChatCommand('blackout', function(source, args, rawCommand)
  85. ToggleBlackout()
  86. end, {
  87. help = 'Toggle Blackout'
  88. }, 0)
  89. end)
  90. ]]
  91. RegisterCommand('blackout', function(source)
  92. local xPlayer = ESX.GetPlayerFromId(source)
  93. local group = xPlayer.getGroup()
  94. playergroup = group
  95.  
  96. if playergroup == 'admin' or playergroup == 'superadmin' or playergroup == 'mod' then
  97.  
  98. ToggleBlackout()
  99. end
  100. end)
  101.  
  102. RegisterCommand('time', function(source, args, rawCommand)
  103. local xPlayer = ESX.GetPlayerFromId(source)
  104. local group = xPlayer.getGroup()
  105. playergroup = group
  106.  
  107. if playergroup == 'admin' or playergroup == 'superadmin' or playergroup == 'mod' then
  108.  
  109. if tonumber(args[1]) ~= nil and tonumber(args[2]) ~= nil then
  110. SetExactTime(args[1], args[2])
  111. else
  112. print("Invalid syntax, correct syntax is: time <hour> <minute> !")
  113. end
  114. end
  115. end)
  116.  
  117. RegisterCommand('weather', function(source, args)
  118. local xPlayer = ESX.GetPlayerFromId(source)
  119. local group = xPlayer.getGroup()
  120. playergroup = group
  121.  
  122. if playergroup == 'admin' or playergroup == 'superadmin' or playergroup == 'mod' then
  123.  
  124. local validWeatherType = false
  125. if args[1] == nil then
  126. print("Invalid syntax, correct syntax is: /weather <weathertype> ")
  127. return
  128. else
  129. for i,wtype in ipairs(AvailableWeatherTypes) do
  130. if wtype == string.upper(args[1]) then
  131. SetWeather(args[1])
  132. validWeatherType = true
  133. end
  134. end
  135. if validWeatherType then
  136. print("Weather has been updated.")
  137. else
  138. print("Invalid weather type, valid weather types are: \nEXTRASUNNY CLEAR NEUTRAL SMOG FOGGY OVERCAST CLOUDS ")
  139. print("CLEARING RAIN THUNDER SNOW BLIZZARD SNOWLIGHT XMAS ")
  140. print("HALLOWEEN ")
  141.  
  142. end
  143. end
  144. end
  145. end)
  146.  
  147. RegisterCommand('freezetw', function(source, args, rawCommand)
  148. local xPlayer = ESX.GetPlayerFromId(source)
  149. local group = xPlayer.getGroup()
  150. playergroup = group
  151.  
  152. if playergroup == 'admin' or playergroup == 'superadmin' or playergroup == 'mod' then
  153.  
  154. if args[1]:lower() == 'weather' or args[1]:lower() == 'time' then
  155. FreezeElement(args[1])
  156. else
  157. print("HUH?")
  158. end
  159. end
  160. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement