Aller au contenu

Photo

Server Wide Announcement - Broadcast


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
What function do I use for a Serverwide announcement?

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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,

#3
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
Brilliant. Thank you GoG!

#4
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
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.