Advertisement
Guest User

Untitled

a guest
Aug 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.64 KB | None | 0 0
  1. local displayTime = true
  2. local useMilitaryTime = true
  3. local displayDayOfWeek = true
  4. local displayDate = true
  5. local displayFps = true
  6.  
  7. local timeAndDateString = nil
  8. local hour
  9. local minute
  10. local dayOfWeek
  11. local month
  12. local dayOfMonth
  13. local year
  14.  
  15. local rgb = {r = 255, g = 153, b = 102}
  16. local prevtime = GetGameTimer()
  17. local prevframes = GetFrameCount()
  18. local fps = -1
  19.  
  20. Citizen.CreateThread(function()
  21. while true do
  22. Wait(1)
  23. timeAndDateString = "~r~Time:"
  24.  
  25. if displayTime == true then
  26. CalculateTimeToDisplay()
  27. timeAndDateString = timeAndDateString .. " ~w~" .. hour .. "~r~:~w~" .. minute .. "~r~ | "
  28. end
  29. if displayDayOfWeek == true then
  30. CalculateDayOfWeekToDisplay()
  31. timeAndDateString = timeAndDateString .. "~w~" .. dayOfWeek .. "~r~ | "
  32. end
  33. if displayDate == true then
  34. CalculateDateToDisplay()
  35. timeAndDateString = timeAndDateString .. "~w~" .. month .. "~r~/~w~" .. dayOfMonth .. "~r~/~w~" .. year .. "~r~ | ~w~"
  36. end
  37. if displayFps == true then
  38. CalculateDateToDisplay()
  39. timeAndDateString = timeAndDateString .. "~w~" .. fps .. " ~r~FPS ~r~"
  40. end
  41.  
  42. SetTextFont(0)
  43. SetTextProportional(1)
  44. SetTextScale(0.30, 0.30)
  45. SetTextColour(255, 255, 255, 255)
  46. SetTextDropshadow(0, 0, 0, 0, 255)
  47. SetTextEdge(1, 0, 0, 0, 255)
  48. SetTextDropShadow()
  49. SetTextOutline()
  50. SetTextRightJustify(true)
  51. SetTextWrap(0.1,0.93)
  52. SetTextEntry("STRING")
  53.  
  54. AddTextComponentString(timeAndDateString)
  55. DrawText(0.01, 0.01)
  56.  
  57. end
  58. end)
  59.  
  60. function CalculateTimeToDisplay()
  61. hour = GetClockHours()
  62. minute = GetClockMinutes()
  63.  
  64. if useMilitaryTime == false then
  65. if hour == 0 or hour == 24 then
  66. hour = 12
  67. elseif hour >= 13 then
  68. hour = hour - 12
  69. end
  70. end
  71.  
  72. if hour <= 9 then
  73. hour = "0" .. hour
  74. end
  75. if minute <= 9 then
  76. minute = "0" .. minute
  77. end
  78. end
  79.  
  80. function CalculateDayOfWeekToDisplay()
  81. dayOfWeek = GetClockDayOfWeek()
  82.  
  83. if dayOfWeek == 0 then
  84. dayOfWeek = "Sunday"
  85. elseif dayOfWeek == 1 then
  86. dayOfWeek = "Monday"
  87. elseif dayOfWeek == 2 then
  88. dayOfWeek = "Tuesday"
  89. elseif dayOfWeek == 3 then
  90. dayOfWeek = "Wednesday"
  91. elseif dayOfWeek == 4 then
  92. dayOfWeek = "Thursday"
  93. elseif dayOfWeek == 5 then
  94. dayOfWeek = "Friday"
  95. elseif dayOfWeek == 6 then
  96. dayOfWeek = "Saturday"
  97. end
  98. end
  99.  
  100. function CalculateDateToDisplay()
  101. month = GetClockMonth()
  102. dayOfMonth = GetClockDayOfMonth()
  103. year = 2018
  104.  
  105. if month == 0 then
  106. month = "1"
  107. elseif month == 1 then
  108. month = "2"
  109. elseif month == 2 then
  110. month = "3"
  111. elseif month == 3 then
  112. month = "4"
  113. elseif month == 4 then
  114. month = "5"
  115. elseif month == 5 then
  116. month = "6"
  117. elseif month == 6 then
  118. month = "7"
  119. elseif month == 7 then
  120. month = "8"
  121. elseif month == 8 then
  122. month = "9"
  123. elseif month == 9 then
  124. month = "10"
  125. elseif month == 10 then
  126. month = "11"
  127. elseif month == 11 then
  128. month = "12"
  129. end
  130. end
  131.  
  132. Citizen.CreateThread(function()
  133.  
  134. while not NetworkIsPlayerActive(PlayerId()) or not NetworkIsSessionStarted() do
  135. Citizen.Wait(250)
  136. prevframes = GetFrameCount()
  137. prevtime = GetGameTimer()
  138. end
  139.  
  140. while true do
  141. curtime = GetGameTimer()
  142. curframes = GetFrameCount()
  143.  
  144. if((curtime - prevtime) > 1000) then
  145. fps = (curframes - prevframes) - 1
  146. prevtime = curtime
  147. prevframes = curframes
  148. end
  149.  
  150. if IsGameplayCamRendering() and fps >= 0 then
  151. PrintText(fps .. " FPS")
  152. end
  153. Citizen.Wait(1)
  154. end
  155. end)
  156.  
  157. function PrintText(text)
  158. SetTextEntry("STRING")
  159. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement