Timed chat messasge not working? HELP!


function ChatWarning()
	print("ChatWarning() called.")
	PrintMessage(HUD_PRINTTALK, "Maintenance mode: On
 The server may become unstable or close unexpectedly!")
end


if maintenanceon == true then
	timer.Create("ChatWarning", 30, 0, ChatWarning())
end

Why isn’t this working? I’m trying to make it continuously print to the chat every 30 seconds if maintenancemode == true.

where are you putting this file on the client or the server?

lua/autorun


function chatWarning()
	print("ChatWarning() called.")
	PrintMessage(HUD_PRINTTALK, "Maintenance mode: On
 The server may become unstable or close unexpectedly!")
end


if maintenanceon == true then
	timer.Create("WarningMessage", 30, 0, chatWarning) -- Dont need () on functions in the timer
end


This should work just tested it

Thank you!