Author Topic: Teamchat Function help  (Read 543 times)

What's the function for when a client teamchats? I want to edit Script_ChatLogger to include teamchat messages. Even better, messageAll and messageAllExcept (Unless you're exempted from the messageAllExcept message)functions. I think these functions are server-sided.

Code: [Select]
package chatLogger
{
function clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdChatMessage(%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
%newMsg=["[Global Chat]"]["@getDateTime()@"]["@%name@"]: "@%msg;
textToFileAppend(%newMsg,"ChatLogger.txt");
}
function clientcmdTeamChatMessage(%team,%client,%b,%c,%all,%PreTag,%name,%postTag,%msg)
{
parent::clientcmdTeamChatMessage(%team,%client,%b,%c,%all,%PreTag,%name,%postTag,%msg);
%newMsg="[@("Team Chat: ",%team)@]["@getDateTime()@"]["@%name@"]: "@%msg;
textToFileAppend(%newMsg,"ChatLogger.txt");
}
};
activatePackage(chatLogger);

function textToFileAppend(%text,%filename)
{
%file = new fileObject();
%file.openForAppend("Config/client/"@%filename);
%file.writeLine(%text);
%file.close();
%file.delete();
}
« Last Edit: October 08, 2010, 07:24:35 PM by frogger3140 »

What's the function for when a client teamchats? I want to edit Script_ChatLogger to include teamchat messages. Even better, messageAll and messageAllExcept (Unless you're exempted from the messageAllExcept message)functions.
Ages ago I already made a "LogWriter" add-on so I don't suggest making a new one, but feel free to make one for your own benefit.

Your code only works because you're a client; you want your code to work on the server. You would want to package "serverCmdMessageSent(%client, %text)".

For team message, package:
serverCmdTeamMessageSent(%client, %text)

Ages ago I already made a "LogWriter" add-on so I don't suggest making a new one, but feel free to make one for your own benefit.

Your code only works because you're a client; you want your code to work on the server. You would want to package "serverCmdMessageSent(%client, %text)".

For team message, package:
serverCmdTeamMessageSent(%client, %text)

Oh, I want the code to work client-sided.
« Last Edit: October 08, 2010, 07:25:08 PM by frogger3140 »


Try this:
trace(1);  (warning: spammy. hurry with the next part or you will have a very full console. Also, try not to rotate your view)
Send a teamchat message.
trace(0); (ASAP. Once you do, the spammy bit will stop)

There will probably be a bit of useful information in the console, now. Depending on how fast you are, between 50% and 99.9% of the information added will be useless.

Oh, I want the code to work client-sided.
Sorry, that's OK to do.

Try this:
trace(1);  (warning: spammy. hurry with the next part or you will have a very full console. Also, try not to rotate your view)
Send a teamchat message.
trace(0); (ASAP. Once you do, the spammy bit will stop)

There will probably be a bit of useful information in the console, now. Depending on how fast you are, between 50% and 99.9% of the information added will be useless.

Code: [Select]
trace(1); commandToServer('TeamMessageSent',"Test."); schedule(ServerConnection.getPing()*2+1,0,trace,0);
@fullconsole:
Code: [Select]
cls();
« Last Edit: October 12, 2010, 04:47:48 AM by Bauklotz »