ItsMods

Full Version: Change [Message] value in OnSay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
onSay(string Message, etc.. )
Can I change the value of Message? so when text passed to the game will be different than what is really written?
public override ChatType OnSay(string Message, ServerClient Client)
{
ServerPrint("Player " + Client.Name + " said " + Message);

return ChatType.ChatContinue;//Send the chat to the next plugin [Eventually to the game]
}
This code doesn't change the original value of Message. instead, it gives it to you only like in Read-only. I want to change it if possible.
[Edit]
For example: If someone wrote anything like "Hi guys" in the game will show another text that I predefined like "You cannot chat buddy, too bad haha".
I really want it for something else, to replace a list of texts to another for some reason. If it is possible to change the value of Message, that would be great.
Well that's probably possible to do but seems not what you want. You can realize what you just explained like this
CSHARP Code
  1. public override ChatType OnSay(string Message, ServerClient Client)
  2. {
  3. if(Message=="Hi guys")
  4. {
  5. TellClient(Client.ClientNum, "You cannot chat blabla",true);
  6. return ChatType.ChatNone;
  7. }
  8. else
  9. return ChatType.ChatContinue;
  10. }
So I can't change what is written in chat ( completely or partially ) by some client to something else without using ServerSay or TellClient and show the message as if he said it?
[sorry 2 edits Tongue]
Well it's not possible with the current server addon. But it should be possible to add it to the addon. However as you said you can 'fake' it (ServerSay(Client.Name + ": I am an idiot", true);)
(06-29-2012, 19:51)zxz0O0 Wrote: [ -> ]Well it's not possible with the current server addon. But it should be possible to add it to the addon. However as you said you can 'fake' it (ServerSay(Client.Name + ": I am an idiot", true)Wink

lol, this would be very funny xD