Blockland Forums > Suggestions & Requests
serverCmdMessageSent source
(1/4) > >>
Electrk.:
I would like to request the source for the function serverCmdMessageSent and possibly various other functions (like messageAll and stuff)
It would be useful for many add-on makers
-Jetz-:
Greek has made a decent replication in Slayer, but the original would be nice. The function itself kinda needs to be segmented off. Filtering a message for e-tard and spam and link parsing should be in its own function, so if you have something like team chat or some other channel, you can simply apply the same function and mods only have to update the one.

Edit: On this note, I think minigameCanDamage and GameConnection::onDeath would also be valuable.
Greek2me:

--- Quote from: Electrk. on January 26, 2014, 05:28:09 PM ---like messageAll

--- End quote ---


--- Code: ---function messageAll(%cmd, %msg, %a, %b, %c, %d, %e, %f, %g, %h, %i, %j, %k, %l, %m, %n, %o, %p, %q, %r)
{
%count = clientGroup.getCount();
for(%index = 0; %index < %count; %index ++)
messageClient(clientGroup.getObject(%index), %cmd, %msg, %a, %b, %c, %d, %e, %f, %g, %h, %i, %j, %k, %l, %m, %n, %o, %p, %q, %r);
}
--- End code ---
Color:
< Greek2Me wore it better >
Smallguy:

--- Code: ---package messageSentPackage {
   function serverCmdMessageSent(%client, %text) {

      if(spamAlert(%client))
         return; //flood?

      %obj = %client.player;
      if(isObject(%obj)) {

         %obj.playthread(0,"talk");
         %obj.schedule(strlen(%text) * 50, stopthread, 0);

      }

      %text=stripMlControlChars(%text);
      %text=lTrim(trim(%text));
      //missing link parsing (RTB has this)
      if(strlen(%text) >= $Pref::Server::MaxChatLen)
         %text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);

      %entiremessage = '\c7%1\c3%2\c7%3\c6: %4'@"\c7"@%client.clanprefix @ "\c3" @ %client.name @ "\c7" @     %client.clansuffix @ "\c6" @ ": " @ %text;
      commandToAll('chatMessage',%client,'','',%entiremessage, %client.clanprefix,%client.name,%client.clansuffix, %text);

   }
};
activatepackage(messageSentPackage);
--- End code ---
Navigation
Message Index
Next page

Go to full version