• 0
Sign in to follow this  
Dissidia

#main cooldown

Question

15 answers to this question

Recommended Posts

  • 0

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.

  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0
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..

Share this post


Link to post
Share on other sites
  • 0

@Radian after a re-pull and rebuild it is working properly for me now

Edited by Antares

Share this post


Link to post
Share on other sites
  • 0

@Antares I did try rebuilding and test it again sometimes its working but most of the time its not.

Share this post


Link to post
Share on other sites
  • 0
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.

Share this post


Link to post
Share on other sites
  • 0
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

Share this post


Link to post
Share on other sites
  • 0

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 by Antares
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
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..

Share this post


Link to post
Share on other sites
  • 0
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 by Sirique

Share this post


Link to post
Share on other sites
  • 0
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 by nasagnilac
  • Upvote 1

Share this post


Link to post
Share on other sites
  • 0
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!

Share this post


Link to post
Share on other sites
  • 0

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;
}

 

screenOrion Online107.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this