I’m trying to figure out how to make a resource that prints a chat message to every player in the server at a specific time, judged by the server system.
I tried this:
client.lua
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local years, months, days, hours, minutes, seconds = Citizen.InvokeNative(0x50C7A99057A69748, Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt(), Citizen.PointerValueInt())
if(hours == 23 or hours == 3 or hours == 7 or hours == 11 or hours == 15 or hours == 19) then
if minutes == 55 then
TriggerServerEvent("RestartAlert", Config.Messages.Minutes5)
end
if minutes == 58 then
TriggerServerEvent("RestartAlert", Config.Messages.Minutes2)
end
if minutes == 59 then
TriggerServerEvent("RestartAlert", Config.Messages.Minutes1)
end
end
end
end)
server.lua
RegisterServerEvent("RestartAlert")
AddEventHandler("RestartAlert", function(text)
TriggerClientEvent('chatMessage', -1, "^8^*" .. Config.Prefix .. "^0^r ", {30, 144, 255}, text)
if Config.SpamWarning == true then
TriggerClientEvent('chatMessage', -1, "^8^*" .. Config.Prefix .. "^0^r ", {30, 144, 255}, text)
TriggerClientEvent('chatMessage', -1, "^8^*" .. Config.Prefix .. "^0^r ", {30, 144, 255}, text)
end
end)
So the point is for it to print the messages 5, 2 and 1 minute before 24:00, 04:00, 08:00, 12:00, 16:00 and 20:00. But it doesn’t seem to do that 
Is it the citizen-thread that’s not really checking the time all the time?
