Automatic server message sender?

Hi all,

I host a server which would be really handy if I can get the server to send messages periodically using the “say” command.

Does anyone know of a plugin or a way to get the server to send messages periodically to the chat for the players to see?

1 Like

Hello!

Yes, this is possible by scripting a Lua plugin for the server.

Here’s the example Lua:

local announcementInterval = 600000 --in milliseconds
local announcementMessage = "Your message here!" --string that will appear in chat
--configure above this line
function onInit()
	MP.RegisterEvent("announce","announce")
	MP.CreateEventTimer("announce", announcementInterval))
end
function announce()
	MP.SendChatMessage(-1, announcementMessage)
end

Save that as a .lua file, in a plugin folder in the server’s .../Resources/Server/ directory:
image

Start your server and it should send a message to all clients once every 10 minutes or however often you configure it.

1 Like

Thank you ! I will give this a go! Appreciate the detailed reply!