I made a system similar to something that was suggested here:
http://forums.graalonline.com/forums....php?p=1485077
Basically, the system allows you to send mass messages to only your online buddies (same server) by either the gui-based method or the chat-based method. For the gui-based method, you will need to have the scripted playerlist enabled.
To enable the scripted playerlist:
F3 --> General --> Player list Options --> Check the box that reads "Use in-game playerlist"
If you have the scripted playerlist enabled, then simply right-click on any entry in the playerlist to bring up a new option for your popup menu:
Message All Buddies
Click on this button to bring up a window similar to the mass-message window.
Currently, only the 'Close' and 'Send' buttons work, the 'History' button does nothing but is there to make it easier to add functionality to it in the future. Simply type your message and press send.
For the chat-based method, simply say
"tobuddies: <message here>" (without the braces) and your message will have sent.
I also added two separate features, which are a cooldown system to prevent spamming (currently a 15 second cooldown in-between messages which can be easily changed) and an ignoring feature that allows you to ignore all buddy mass messages.
Command for ignoring/allowing mass buddy messages:
/bmsg ignore
Important Note: This system uses the NPC-Server to send messages between players so it requires you to not have the NPC-Server on ignore. Also, when installing this system, you will need to customize the onCreated() portion to your Control-NPC for when a player logs in since the scripted playerlist automatically removes any new rows that are not a part of the default system when you first log on. It is important that you do this or else the row will not appear when the player right-clicks someone on their playerlist.
PHP Code:
/*
*Buddy Communication System
*@author Gambet
*NOTE: Requires the scripted playerlist
*/
function onActionServerSide(command, buddyList, message, sender)
{
if (command == "sendBuddyMessage")
{
for (p: allplayers)
{
if (p.account in buddyList)
{
if (p.level.name != NULL)
{
if (p.client.bmsg_ignore == false) //Send message only if user allows mass buddy messages
p.sendPM("\nBuddy Message From" SPC sender @ ":\n\n" @ replaceText(message, "\\n", "#b"));
}
}
}
}
}
function replaceText(txt, a, b) //replaceText parser-function by DustyPorViva
{
if (txt.pos(a) < 0) return txt;
temp.txtpos = txt.positions(a);
temp.newtxt = txt.substring(0, txtpos[0]);
for (temp.i = 0; i < txtpos.size(); i++)
{
newtxt @= b;
newtxt @= txt.substring(txtpos[i]+a.length(), txt.substring(txtpos[i]+a.length()).pos(a));
}
return newtxt;
}
//#CLIENTSIDE
function onCreated()
{
this.customMenuEntry = "Message All Buddies"; //Row title
if (PlayerList_Menu.findtext(this.customMenuEntry) == -1)
("-Playerlist").addCustomMenuEntry(1, this.customMenuEntry);
}
function onPlayerChats()
{
if (player.chat == "/bmsg ignore") //Toggle between allowing and ignoring mass buddy messages
{
client.bmsg_ignore = !client.bmsg_ignore;
player.chat = "Mass Buddy Messages: " @ (client.bmsg_ignore == false ? "Allowed" : "Ignored");
}
else if (player.chat.starts("tobuddies:")) //Chat-based mass buddy messages
{
if (this.bmsg_cooldown <= timevar2)
{
temp.messageToSend = player.chat.substring(10);
triggerserver("gui", name, "sendBuddyMessage", findPlayerBuddies(), messageToSend, player.account);
player.chat = "";
this.bmsg_cooldown = timevar2 + 15;
}
else
{
player.chat = "You can't send another buddy mass for another" SPC int(this.bmsg_cooldown - timevar2) SPC "second(s)!";
}
}
}
function PlayerList_Menu.onSelect(entryid, text)
{
if (text == this.customMenuEntry) toBuddyGUI(); //If user selects 'Message All Buddies'
}
function toBuddyGUI()
{
new GuiWindowCtrl("ToBuddy_Window")
{
profile = GuiBlueWindowProfile;
x = (screenwidth/2 - 100);
y = (screenheight/2-100);
width = 425;
height = 370;
canclose = "false";
text = "Message To Buddies";
new GuiScrollCtrl("ToBuddy_Scroll")
{
profile = GuiBlueScrollProfile;
x = 5;
y = 22;
width = 413;
height = 305;
hScrollBar = "alwaysOff";
vScrollBar = "dynamic";
new GuiMLTextEditCtrl("ToBuddy_ScrollText")
{
useownprofile = true;
profile = "GuiBlueTextProfile";
x = 8;
y = 5;
height = 40;
width = 405;
}
}
new GuiButtonCtrl("ToBuddy_CloseButton")
{
profile = GuiBlueButtonProfile;
x = 20;
y = 335;
width = 90;
height = 25;
text = "Close";
}
new GuiButtonCtrl("ToBuddy_HistoryButton")
{
profile = GuiBlueButtonProfile;
x = 117;
y = 335;
width = 90;
height = 25;
text = "History";
}
new GuiButtonCtrl("ToBuddy_SendButton")
{
profile = GuiBlueButtonProfile;
x = 305;
y = 335;
width = 97;
height = 25;
text = "Send";
}
}
}
function ToBuddy_CloseButton.onAction()
{
ToBuddy_Window.destroy();
}
function ToBuddy_SendButton.onAction()
{
temp.messageToSend = ToBuddy_ScrollText.text;
ToBuddy_Window.destroy();
if (this.bmsg_cooldown <= timevar2)
{
triggerserver("gui", name, "sendBuddyMessage", findPlayerBuddies(), messageToSend, player.account);
this.bmsg_cooldown = timevar2 + 15;
}
else
{
player.chat = "You can't send another buddy mass for another" SPC int(this.bmsg_cooldown - timevar2) SPC "seconds!";
}
}
function findPlayerBuddies()
{
temp.buddiesOnline = "";
for (p: allplayers)
{
if (p.isbuddy)
{
if (buddiesOnline.index(p.account) == -1)
buddiesOnline.add(p.account); //Array of user's online buddies
}
}
return buddiesOnline;
}
Edit: Here are some screenshots:
Feel free to customize it as you please.