Dissidia Posted August 8, 2017 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 535 Reputation: 23 Joined: 11/19/11 Last Seen: June 8, 2023 Share Posted August 8, 2017 how to add 5 seconds cooldown on #main chat? thanks 1 Quote Link to comment Share on other sites More sharing options...
0 Kakaroto Posted August 8, 2017 Group: Members Topic Count: 99 Topics Per Day: 0.02 Content Count: 638 Reputation: 95 Joined: 05/11/12 Last Seen: 18 hours ago Share 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 Link to comment Share on other sites More sharing options...
0 Dissidia Posted August 8, 2017 Group: Members Topic Count: 155 Topics Per Day: 0.03 Content Count: 535 Reputation: 23 Joined: 11/19/11 Last Seen: June 8, 2023 Author Share Posted August 8, 2017 Thank you. Problem solved. Quote Link to comment Share on other sites More sharing options...
0 Radian Posted August 9, 2017 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Antares Posted December 24, 2017 Group: Members Topic Count: 74 Topics Per Day: 0.02 Content Count: 420 Reputation: 89 Joined: 01/30/12 Last Seen: April 29, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 Radian Posted December 29, 2017 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Antares Posted January 9, 2018 Group: Members Topic Count: 74 Topics Per Day: 0.02 Content Count: 420 Reputation: 89 Joined: 01/30/12 Last Seen: April 29, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 Radian Posted January 10, 2018 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share Posted January 10, 2018 @Antares I did try rebuilding and test it again sometimes its working but most of the time its not. Quote Link to comment Share on other sites More sharing options...
0 Antares Posted January 12, 2018 Group: Members Topic Count: 74 Topics Per Day: 0.02 Content Count: 420 Reputation: 89 Joined: 01/30/12 Last Seen: April 29, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 Radian Posted January 12, 2018 Group: Members Topic Count: 162 Topics Per Day: 0.04 Content Count: 1546 Reputation: 192 Joined: 07/23/14 Last Seen: June 24, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Antares Posted February 20, 2018 Group: Members Topic Count: 74 Topics Per Day: 0.02 Content Count: 420 Reputation: 89 Joined: 01/30/12 Last Seen: April 29, 2023 Share 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 Link to comment Share on other sites More sharing options...
0 nasagnilac Posted March 18, 2018 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Sirique Posted March 18, 2018 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 45 Reputation: 7 Joined: 11/07/14 Last Seen: June 14, 2020 Share 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 Link to comment Share on other sites More sharing options...
0 nasagnilac Posted March 19, 2018 Group: Members Topic Count: 89 Topics Per Day: 0.02 Content Count: 232 Reputation: 15 Joined: 11/02/13 Last Seen: December 19, 2024 Share 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 Link to comment Share on other sites More sharing options...
0 Sirique Posted April 3, 2018 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 45 Reputation: 7 Joined: 11/07/14 Last Seen: June 14, 2020 Share 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 Link to comment Share on other sites More sharing options...
0 Vettra Posted August 28, 2018 Group: Members Topic Count: 19 Topics Per Day: 0.01 Content Count: 34 Reputation: 0 Joined: 07/19/17 Last Seen: January 23, 2020 Share 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 Link to comment Share on other sites More sharing options...
Question
Dissidia
how to add 5 seconds cooldown on #main chat? thanks
Link to comment
Share on other sites
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.