This is a newer, complete remake, of the
Global Message/Event System (please don't post in that thread anymore, in fact, if a moderator feels like it - go ahead and delete it).
Simply put, it's an easy-to-install system that allowed you to send messages on RC too other servers that use the system. The more servers that start using it, the better. None of the "former" versions of the old system works anymore.
Current version: 1
------------------------
Functions:
* Ability to send global messages to all servers that use this system.
* Ability to send private messages to all servers that use this system.
* Ability to turn on/off the display of the messages.
* Ability to check the current players/playercount on all servers that use this system.
------------------------
Commands:
/npcglobalmsg "text in quotes"
/npcsendmsg servername "text in quotes"
/npcplayers servername
Step-by-step Installation Guide
1) Create a new database NPC, and name it "GlobalSys", then copy and paste this code.
PHP Code:
function onCreated() doConnect();
function onInitialized() doConnect();
function onServerListerConnect() doConnect();
function doConnect()
{
enum {
//-- EDIT THESE --\\
SERVER = "SERVER NAME HERE",
ACCESS = "account1,account2,account3,etc",
ENABLEMESSAGES = true,
//-- DO NOT EDIT --\\
VERSION = 1,
CHANNEL = "#GlobalSys",
COMMANDS = "globalmsg,sendmsg,players",
CHECKCOMMANDS = "!globalmessagerequest,!servermessagerequest,!players"
};
sendtext("irc", "logout", "");
sendtext("irc", "login", name);
sendtext("irc", "join", CHANNEL);
sendtext("irc", "privmsg", {CHANNEL, { "!register", SERVER, VERSION, ENABLEMESSAGES }});
}
function onReceiveText(texttype, textoptions, textlines)
{
if (texttype == "irc") {
switch (textoptions) {
case "privmsg":
switch (textlines[2][0]) {
case "!globalmsg":
if (textlines[2][1] != SERVER && ENABLEMESSAGES == true) echo(textlines[2][2]);
break;
case "!servermsg":
if (textlines[2][1] != SERVER && textlines[2][2] == SERVER && ENABLEMESSAGES == true) echo(textlines[2][3]);
break;
case "!getplayers":
if (textlines[2][1] == SERVER) {
for (i: allplayers) {
if (i.level != NULL) temp.players.add(i.account);
else temp.players.add(i.account SPC "(RC)");
}
sendtext("irc", "privmsg", {CHANNEL, {"!updateplayers", temp.players}});
}
break;
}
break;
case "notice":
if (textlines[2][1] == SERVER) echo(textlines[2][2]);
break;
}
}
}
public function hasAccess(acc) return player.account in ACCESS.tokenize();
public function doCommand(command, param)
{
if (command in COMMANDS.tokenize()) (@command)(param[0], param[1]);
}
function globalmsg(text)
{
if (text != NULL) sendtext("irc", "privmsg", {CHANNEL, {CHECKCOMMANDS.tokenize()[0], player.account, text}});
}
function sendmsg(svr, text)
{
if (text != NULL) sendtext("irc", "privmsg", {CHANNEL, {CHECKCOMMANDS.tokenize()[1], player.account, text, svr}});
}
function players(svr)
{
if (svr != NULL) sendtext("irc", "privmsg", {CHANNEL, {CHECKCOMMANDS.tokenize()[2], svr}});
}
Edit the options SERVER, ACCESS and ENABLEMESSAGES to suit your needs. Please, do not alter the other options - doing so might result in a permanent ban from the system.
2) Add the following code inside an
onRCChat() function in your
Control-NPC.
PHP Code:
// -- Events Bot Commands -- \\
temp.args = params;
temp.args.delete(0);
if (("GlobalSys").hasAccess(player.account)) ("GlobalSys").doCommand(params[0], temp.args);
Of course, offensive chat or too much spam, will result in a timed ban from the system. If you violate it too much, you might even get a permanent ban.
Suggestions, feedback, comments - everything is appreciated. And please, use the forums built-in reputation system. If you think this is a horrible idea, give me bad rep, at least then I know its not liked.
Credits too napo who is hosting the HUB on AEON!