1 (edited by Whitefire 2009-08-22 08:26:37)

Topic: [HELP] Coloring chat-all message (Server not Client)

Well hi! smile

I have started modding my mod and one function will be the well-known "/me", was easy to do and works fine. But now players could imitate original messages like "Player is a killing spree", cause the output is a game message...

So is there really no way to change the colors without client modifications? It would be enough to remove the *** before the message...

I didn't find anything about that  really, but in some kind this search function doesn't like me oO xD

Edit: Ok someone said me that it is impossible, coloring only via client...

And I think I wrote in the wrong forum sry ;X (Development)

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]

2 (edited by Soulbound 2009-08-20 19:59:17)

Re: [HELP] Coloring chat-all message (Server not Client)

As far as I know I'm sure there is a function for that.
I didn't try to find it because I don't need it but there is should be one due to the team and all messages colored differently.
If I were you I'd look for it in Player or Character or where is the msg object.
And I think this is possible if you think it twice.

splinter cell conviction will never outshine chaos theory!!!

3

Re: [HELP] Coloring chat-all message (Server not Client)

Ok that keeps me hoping smile Well people said me that it is possible, but I have to code the client, not the server... sad
But that gives me a kick to search again and this time I will look better at all! I still hope it is possible to do it over the server - cause I really don't want to release a client, than I would get lesser people to play my mod... :X

Thanks for your answer smile

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]

4

Re: [HELP] Coloring chat-all message (Server not Client)

Of course it's possible.
I don't know how you do to search your /me and how you do next.
So if you please put your code, that'd help.

|ZPote| buffer[]'s posterous

5 (edited by Whitefire 2009-08-21 09:13:00)

Re: [HELP] Coloring chat-all message (Server not Client)

Hehe ok no problem I show it you - was very easy to do in the hooks.cpp.
Just as an information why I got 3 strings: The msg->message was not writeable, and I just  got knowledge in C so I don't know if there are better methodes in C++ ;D I paste the msg-> message into MeMessage and than I say that the beginning of OutputMeMessage gets all values since the third or forth place (I ask for a space, if someone writes /meis afk, or /me is afk, would be bad if by the first one would be written: Whitefire s afk wink

I add the '\0' to solve wrong output of ugly signs... to say where the string ends smile 1000 is just a value, I can change it, I think the buffer allows only 512 letters right? If yes I will reduce it to the same value..

      else if(!strncmp(msg->message, "/me"))
    {
        int iCount;
        int iCount2 = 0;
        char OutputMeMessage[1000];
        char MeMessage[1000];
        strcpy(MeMessage, msg->message);

        if(MeMessage[3] == ' ')
        {
            iCount = 4;
        }
        else
        {
            iCount = 3;
        }

        for(iCount = iCount; MeMessage[iCount] != '\0';iCount++)
        {
            OutputMeMessage[iCount2] = MeMessage[iCount];
            iCount2++;
        }
        OutputMeMessage[iCount2] = '\0';

        char buf[512] = {0};
        str_format(buf, sizeof(buf), "%s %s", server_clientname(client_id), OutputMeMessage);
        game.send_chat(-1, GAMECONTEXT::CHAT_ALL, buf);

        for(iCount = 0; iCount < 1000; iCount++)
        {
            MeMessage[iCount] = ' ';
            OutputMeMessage[iCount] = ' ';
        }
        MeMessage[0] = '\0';
        OutputMeMessage[0] = '\0';
    } 

At which line in the hook.cpp?

I searched for:

    if(msgtype == NETMSGTYPE_CL_SAY)
    {
        NETMSG_CL_SAY *msg = (NETMSG_CL_SAY *)rawmsg;
        int team = msg->team;
        if(team)
            team = p->team;
        else
            team = GAMECONTEXT::CHAT_ALL;

If you haven't written there already an own "if" than you have to write "if" and not "else if".


So if we write "/me is afk" than a yellow game message will appear:


*** Whitefire is afk


What I want to change is the color or / and to remove the *** smile


Edit: Ah forgot to say, this worked in the nrace (where I was testing first). In the normal teeworlds source code is a library or something like that missed, cause BAM says he don't know msg->message when I compile... -.- And I need it there too, but well thats just a small problem, I think I will solve that smile

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]

6

Re: [HELP] Coloring chat-all message (Server not Client)

i beleve it's clientside, but to be sure go look where void  send_chat(int, int, char) is explained

7 (edited by Whitefire 2009-08-21 14:36:07)

Re: [HELP] Coloring chat-all message (Server not Client)

Ah yep forgot to define it again. Ehm well my friend also founded already the ***, the problem is, that this is the dbg_msg (debug) which is shown in the DOS window (or shell), not in the chat big_smile Thanks anyway! smile

I didn't found anything until now, so I think it's really just possible to do it over the client.

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]

8

Re: [HELP] Coloring chat-all message (Server not Client)

Maybe you could rewrite the function in server side or something like that.

splinter cell conviction will never outshine chaos theory!!!

9

Re: [HELP] Coloring chat-all message (Server not Client)

Yeah I thought about creating a own chat message type. Well but I don't know if I will be able to, I don't think this will be that easy, but I will try it of course! smile

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]

10

Re: [HELP] Coloring chat-all message (Server not Client)

As I said on Skype long time before you started this topic; it is impossible without make a custom client.

11

Re: [HELP] Coloring chat-all message (Server not Client)

Ehm I started the topic at the same time when we have been talking in skype?
Yes, but still wanted to know if there is not a small possibility to take use of. Well now I know there is really nothing what I could do!
I could add two ## or delete this /me function... xD

Well problem can't be solved, so topic should end now cause here is nothing to talk about anymore. Thanks anyway for all suggestions wink

Avatar by Crises
Tee-Project - Website coming soon... [http://project.tee-city.net]