What function do I use for a Serverwide announcement?
Server Wide Announcement - Broadcast
Débuté par
Buddywarrior
, avril 24 2012 02:24
#1
Posté 24 avril 2012 - 02:24
#2
Posté 24 avril 2012 - 02:46
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,
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
Posté 24 avril 2012 - 07:26
Brilliant. Thank you GoG!
#4
Posté 24 avril 2012 - 08:51
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.





Retour en haut






