Display channel MessageDelay

bWolfie

I'm the man
Messages
850
Points
0
Location
Alberta, Midgard
Github
bWolfie
Emulator
In the following code in channel.c, when your tick is not at 0 it will direct you to message 1455, "You're talking too fast!"

    if (sd && chan->msg_delay != 0
     && DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) > 0
     && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
        clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd,1455));
        return;
    }


I wish to display the remaining ticks (seconds) instead of a static message. E.g. message 1455, "You cannot send a message to this channel for another %d seconds."

Thanks.

 
Last edited by a moderator:
Let me rephrase my question...

How do I send clifmessage->so it can send a number to %d in messages.conf?

 
Bumping this to say I found the solution and wanted to post it for future users.

In channel.c, find:

Code:
clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd,1455));

Replace with:

Code:
char output[150];
sprintf(output, msg_txt(1550), DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) / 1000); // "You cannot send a message to this channel for another %d seconds."
clif->messagecolor_self(sd->fd, COLOR_RED, output);

In messages.conf, create a new custom message. In the example above, 1550 was used. You should use whatever the next available one is.

Code:
1550: You cannot send a message to this channel for another %d seconds.
 
Back
Top