Blockland Forums > Modification Help
Teamchat Function help
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. I think these functions are server-sided.
--- Code: ---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();
}
--- End code ---
Kalphiter:
--- Quote from: frogger3140 on October 08, 2010, 07:19:04 PM ---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.
--- End quote ---
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)
frogger3140:
--- Quote from: Kalphiter on October 08, 2010, 07:21:30 PM ---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)
--- End quote ---
Oh, I want the code to work client-sided.
frogger3140:
Bump
Uristqwerty:
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.