Dissidia Posted August 8, 2017 Posted August 8, 2017 how to add 5 seconds cooldown on #main chat? thanks 1 Quote
0 Kakaroto Posted August 8, 2017 Posted August 8, 2017 Go to: emulator/conf/channels.conf { name: "#main" alias: "[main]" color: "White" type: "CHAN_TYPE_PUBLIC" delay: 1000 autojoin: false leave: false }, Use delay: 1000, the time setting is in milliseconds. 1 Quote
0 Radian Posted August 9, 2017 Posted August 9, 2017 Im having issues with the channel system, and if im using normal account it keeps saying im talking to fast even tho im not.. did you encounter that kind of issue? @Dissidia Quote
0 Antares Posted December 24, 2017 Posted December 24, 2017 On 2017. 08. 09. at 5:04 AM, Radian said: Im having issues with the channel system, and if im using normal account it keeps saying im talking to fast even tho im not.. did you encounter that kind of issue? @Dissidia Same issue here Quote
0 Radian Posted December 29, 2017 Posted December 29, 2017 On 12/24/2017 at 10:49 AM, Antares said: Same issue here You encounter this issue too? im trying to look what is causing this problem.. Quote
0 Antares Posted January 9, 2018 Posted January 9, 2018 (edited) @Radian after a re-pull and rebuild it is working properly for me now Edited January 9, 2018 by Antares Quote
0 Radian Posted January 10, 2018 Posted January 10, 2018 @Antares I did try rebuilding and test it again sometimes its working but most of the time its not. Quote
0 Antares Posted January 12, 2018 Posted January 12, 2018 On 2018. 01. 10. at 3:15 PM, Radian said: @Antares I did try rebuilding and test it again sometimes its working but most of the time its not. Oh I'll keep an eye out and try spamming the channels regularly to see if it's the same for me, or not. Quote
0 Radian Posted January 12, 2018 Posted January 12, 2018 1 hour ago, Antares said: Oh I'll keep an eye out and try spamming the channels regularly to see if it's the same for me, or not. Thank you.. I also try somethings and see what i can find Quote
0 Antares Posted February 20, 2018 Posted February 20, 2018 (edited) I think I found it out... I can't write into the channels with my regular characters, but I can with my group99 admin character. I am not entirely sure, but so far it looks like this is it. this is the line that causes the problem (/src/map/channel.cpp, 442): if(!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) > 0) { Admins bypass the check, but regular players don't and the tick always returns a number larger than 0, so the "Talking too fast" message is displayed. Either the check rule, or the tick setting is faulty. If DIFF_TICK retunrs an absolute value, then this check will always be positive: DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) > 0 Otherwise the sd->channel_tick[idx] part is not set correctly or channel->msg_delay is not a compatible type with sd->channel_tick[idx] , and it yields an incorrect value when added together. I am just guessing here by looking at the code... these are the first possible reasons that occurred to me, but it could be something else as well. Edited February 21, 2018 by Antares 1 Quote
0 nasagnilac Posted March 18, 2018 Posted March 18, 2018 int channel_send(struct Channel *channel, struct map_session_data *sd, const char *msg) { int idx = 0; if(!channel || !sd || !msg || (idx = channel_pc_haschan(sd, channel)) < 0) return -1; if(!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) > 0) { char cdmessage[CHAT_SIZE_MAX]; int cdseconds = DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) / 1000; int cdmilliseconds = (DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) - (cdseconds * 1000))/100; //clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1455),false,SELF); //You're talking too fast! safesnprintf(cdmessage, sizeof(cdmessage), "You still have %d.%d second(s) left before you can use the channel again.", cdseconds, cdmilliseconds); clif_displaymessage(sd->fd, cdmessage); return -2; } else { char output[CHAT_SIZE_MAX]; unsigned long color = channel->color; if((channel->opt&CHAN_OPT_COLOR_OVERRIDE) && sd->fontcolor && sd->fontcolor < channel_config.colors_count && channel_config.colors[sd->fontcolor]) color = channel_config.colors[sd->fontcolor]; safesnprintf(output, CHAT_SIZE_MAX, "%s %s : %s", channel->alias, sd->status.name, msg); clif_channel_msg(channel,output,color); sd->channel_tick[idx] = gettick(); } return 0; } Try this for cooldown message.. Quote
0 Sirique Posted March 18, 2018 Posted March 18, 2018 (edited) 2 hours ago, nasagnilac said: int channel_send(struct Channel *channel, struct map_session_data *sd, const char *msg) { int idx = 0; if(!channel || !sd || !msg || (idx = channel_pc_haschan(sd, channel)) < 0) return -1; if(!pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) > 0) { char cdmessage[CHAT_SIZE_MAX]; int cdseconds = DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) / 1000; int cdmilliseconds = (DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) - (cdseconds * 1000))/100; //clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1455),false,SELF); //You're talking too fast! safesnprintf(cdmessage, sizeof(cdmessage), "You still have %d.%d second(s) left before you can use the channel again.", cdseconds, cdmilliseconds); clif_displaymessage(sd->fd, cdmessage); return -2; } else { char output[CHAT_SIZE_MAX]; unsigned long color = channel->color; if((channel->opt&CHAN_OPT_COLOR_OVERRIDE) && sd->fontcolor && sd->fontcolor < channel_config.colors_count && channel_config.colors[sd->fontcolor]) color = channel_config.colors[sd->fontcolor]; safesnprintf(output, CHAT_SIZE_MAX, "%s %s : %s", channel->alias, sd->status.name, msg); clif_channel_msg(channel,output,color); sd->channel_tick[idx] = gettick(); } return 0; } Try this for cooldown message.. I tried that and now it says I have 1366748.7 second(s) left to wait until next msg, but it was the first msg I attempted. Still work for my admin account. Edited March 18, 2018 by Sirique Quote
0 nasagnilac Posted March 19, 2018 Posted March 19, 2018 (edited) delay: 5000 set this one for 5 seconds cooldown. its normal that admin bypass the cooldown. In able for you make fast reply. But you can remove this part !pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && So that all user even gm groups has a cooldown in you #main. Edited March 19, 2018 by nasagnilac 1 Quote
0 Sirique Posted April 3, 2018 Posted April 3, 2018 On 19/03/2018 at 5:16 PM, nasagnilac said: delay: 5000 set this one for 5 seconds cooldown. its normal that admin bypass the cooldown. In able for you make fast reply. But you can remove this part !pc_has_permission(sd, PC_PERM_CHANNEL_ADMIN) && channel->msg_delay != 0 && So that all user even gm groups has a cooldown in you #main. Thank you, that fixed it! Quote
0 Vettra Posted August 28, 2018 Posted August 28, 2018 Help pls code: int channel_send(struct Channel *channel, struct map_session_data *sd, const char *msg) { int idx = 0; if(!channel || !sd || !msg || (idx = channel_pc_haschan(sd, channel)) < 0) return -1; if(DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) > 0) { char cdmessage[CHAT_SIZE_MAX]; int cdseconds = DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) / 1000; int cdmilliseconds = (DIFF_TICK(sd->channel_tick[idx] + channel->msg_delay, gettick()) - (cdseconds * 1000))/100; //clif_messagecolor(&sd->bl,color_table[COLOR_RED],msg_txt(sd,1455),false,SELF); //You're talking too fast! safesnprintf(cdmessage, sizeof(cdmessage), "You still have %d.%d second(s) left before you can use the channel again.", cdseconds, cdmilliseconds); clif_displaymessage(sd->fd, cdmessage); return -2; } else { char output[CHAT_SIZE_MAX]; unsigned long color = channel->color; if((channel->opt&CHAN_OPT_COLOR_OVERRIDE) && sd->fontcolor && sd->fontcolor < channel_config.colors_count && channel_config.colors[sd->fontcolor]) color = channel_config.colors[sd->fontcolor]; safesnprintf(output, CHAT_SIZE_MAX, "%s %s : %s", channel->alias, sd->status.name, msg); clif_channel_msg(channel,output,color); sd->channel_tick[idx] = gettick(); } return 0; } Quote
Question
Dissidia
how to add 5 seconds cooldown on #main chat? thanks
15 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.