The Time Syncs With This Script vSync !
local displayTime = true
local useMilitaryTime = true
local displayDayOfWeek = true
local displayDate = true
local displayFps = true
local timeAndDateString = nil
local hour
local minute
local dayOfWeek
local month
local dayOfMonth
local year
local rgb = {r = 255, g = 153, b = 102}
local prevtime = GetGameTimer()
local prevframes = GetFrameCount()
local fps = -1
Citizen.CreateThread(function()
while true do
Wait(1)
timeAndDateString = "~r~Time:"
if displayTime == true then
CalculateTimeToDisplay()
timeAndDateString = timeAndDateString .. " ~w~" .. hour .. "~r~:~w~" .. minute .. "~r~ | "
end
if displayDayOfWeek == true then
CalculateDayOfWeekToDisplay()
timeAndDateString = timeAndDateString .. "~w~" .. dayOfWeek .. "~r~ | "
end
if displayDate == true then
CalculateDateToDisplay()
timeAndDateString = timeAndDateString .. "~w~" .. month .. "~r~/~w~" .. dayOfMonth .. "~r~/~w~" .. year .. "~r~ | ~w~"
end
if displayFps == true then
CalculateDateToDisplay()
timeAndDateString = timeAndDateString .. "~w~" .. fps .. " ~r~FPS ~r~"
end
SetTextFont(4)
SetTextProportional(1)
SetTextScale(0.50, 0.50)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextRightJustify(true)
SetTextWrap(0.1,0.93)
SetTextEntry("STRING")
AddTextComponentString(timeAndDateString)
DrawText(0.01, 0.01)
end
end)
function CalculateTimeToDisplay()
hour = GetClockHours()
minute = GetClockMinutes()
if useMilitaryTime == false then
if hour == 0 or hour == 24 then
hour = 12
elseif hour >= 13 then
hour = hour - 12
end
end
if hour <= 9 then
hour = "0" .. hour
end
if minute <= 9 then
minute = "0" .. minute
end
end
function CalculateDayOfWeekToDisplay()
dayOfWeek = GetClockDayOfWeek()
if dayOfWeek == 0 then
dayOfWeek = "Sunday"
elseif dayOfWeek == 1 then
dayOfWeek = "Monday"
elseif dayOfWeek == 2 then
dayOfWeek = "Tuesday"
elseif dayOfWeek == 3 then
dayOfWeek = "Wednesday"
elseif dayOfWeek == 4 then
dayOfWeek = "Thursday"
elseif dayOfWeek == 5 then
dayOfWeek = "Friday"
elseif dayOfWeek == 6 then
dayOfWeek = "Saturday"
end
end
function CalculateDateToDisplay()
month = GetClockMonth()
dayOfMonth = GetClockDayOfMonth()
year = 2018
if month == 0 then
month = "1"
elseif month == 1 then
month = "2"
elseif month == 2 then
month = "3"
elseif month == 3 then
month = "4"
elseif month == 4 then
month = "5"
elseif month == 5 then
month = "6"
elseif month == 6 then
month = "7"
elseif month == 7 then
month = "8"
elseif month == 8 then
month = "9"
elseif month == 9 then
month = "10"
elseif month == 10 then
month = "11"
elseif month == 11 then
month = "12"
end
end
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) or not NetworkIsSessionStarted() do
Citizen.Wait(250)
prevframes = GetFrameCount()
prevtime = GetGameTimer()
end
while true do
curtime = GetGameTimer()
curframes = GetFrameCount()
if((curtime - prevtime) > 1000) then
fps = (curframes - prevframes) - 1
prevtime = curtime
prevframes = curframes
end
if IsGameplayCamRendering() and fps >= 0 then
PrintText(fps .. " FPS")
end
Citizen.Wait(1)
end
end)
function PrintText(text)
SetTextEntry("STRING")
end