Jump to content
  • 0
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
Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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
Link to comment
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..

Link to comment
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
Link to comment
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
Link to comment
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!

Link to comment
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

Link to comment
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.