Is there a perfect chat announcement addon?

Author Topic: Is there a perfect chat announcement addon?  (Read 2370 times)

Like at random intervals it displays a chat message to everyone? Is there a addon for that?

I couldn't think of one so I just whipped one up.

Untested, but I'll leave it here for a bit of peer checking and then I might release it packaged later.


if(!$pref::server::announcementDelay)
   $pref::server::announcementDelay = 120000; //Default: 2 minutes

function servercmdAddAnnouncement(%client, %word0, %word1, %word2, %word3, %word4, %word5, %word6, %word7, %word8, %word9, %word10, %word11, %word12, %word13, %word14, %word15)
{
   if(!%client.isAdmin)
      return;
      
   for(%i = 0; %i<=16; %i++)
   {
      %message = %message SPC %word[%i];
   }
   
   %message = trim(%message);
   %message = strReplace(%message, "_", " ");
   
   $pref::server::announcementCount++;
   $pref::server::announcement[$pref::server::announcementCount] = %message;
   
   %client.chatMessage("Added announcement.");
   
   if(!$announcementLoopRunning)
   {
      $announcementLoopRunning = true;
      announcementLoop(1);
   }
}

function servercmdStopAnnouncements(%client)
{
   if(!%client.isAdmin)
      return;
      
   $announcementLoopRunning = false;
      
   %client.chatMessage("Announcements stopped.");
}

function announcementLoop(%current)
{
   if(!$announcementLoopRunning)
      return;
      
   announce($pref::server::announcement[%current]);
   
   if(%current + 1 > $pref::server::announcementCount)
      schedule($pref::server::announcementDelay, announcementLoop, 1);
   else
      schedule($pref::server::announcementDelay, announcementLoop, %current + 1);
}


I should probably make a command to remove announcements too.
« Last Edit: January 31, 2015, 12:57:32 AM by Pecon »

There is an announcement add-on already out, you can change the rights from host, super admin and admin.
And you can even make it so it can be bottom print, centre print and chat print.

There is an announcement add-on already out, you can change the rights from host, super admin and admin.
And you can even make it so it can be bottom print, centre print and chat print.
Link?


http://rtb-archive.host22.com/add_ons/Server_Announcements.zip
I've used this one for years, I like it a lot. There is a bug though with the "Only-Host" announcement choice. Someone should fix that.

I believe this post belongs in the suggestions and requests

I didnt mean THAT announcements, you know those announements when the host isnt on the dedicated server and at a interval a donation link comes up?

i coded one a while ago, but i'm not proud enough of it to release it

I believe this post belongs in the suggestions and requests
Hes asking if there is one, not if someone can make one.

Hes asking if there is one, not if someone can make one.
Still belongs in suggestions and requests.
He is requesting one, not suggesting.

Still belongs in suggestions and requests.
He is requesting one, not suggesting.

No hes. Right I don't know if there is one

No hes. Right I don't know if there is one
I'm not even sure what you just said.

I'm not even sure what you just said.
He appears to be on a phone, what he meant to say was: "No he's right. I don't know if there is one"
He hit space twice on accident.

He appears to be on a phone, what he meant to say was: "No he's right. I don't know if there is one"
He hit space twice on accident.
In that case, what Pah said is correct, if you are asking for an add-on it goes in the suggestions and requests.