Author Topic: Server Wide Announcement - Broadcast  (Read 310 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Server Wide Announcement - Broadcast
« on: April 24, 2012, 03:24:19 pm »


               What function do I use for a Serverwide announcement?
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Server Wide Announcement - Broadcast
« Reply #1 on: April 24, 2012, 03:46:07 pm »


               There are a couple different ways to go about it. I think the most common would be to make an NPC named "Server" and put it in some inaccessible area. Then just have it shout stuff when needed:


void main()
{
    object oServer = GetObjectByTag("SERVER_NPC");
    string sMessage = "THE SERVER WILL RESET IN 5 MINUTES.";
    AssignCommand(oServer, ActionSpeakString(sMessage, TALKVOLUME_SHOUT));
}


You could also just send a message to all current players by looping through them and using the SendMessage function:

void main()
{
    object oPC = GetFirstPC();
    while (GetIsObjectValid(oPC))
    {
        SendMessageToPC(oPC, "The server will reset in 5 minutes.");
        oPC = GetNextPC();
    }
}


Hope it helps,
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
Server Wide Announcement - Broadcast
« Reply #2 on: April 24, 2012, 08:26:59 pm »


               Brilliant. Thank you GoG!
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Server Wide Announcement - Broadcast
« Reply #3 on: April 24, 2012, 09:51:43 pm »


               Also just to point out that the first option is also nice if you need some server shouts on the fly. You can just have a DM possess the "Server" NPC and shout stuff at will too.