johnbond Posted June 29, 2014 Group: Members Topic Count: 113 Topics Per Day: 0.03 Content Count: 457 Reputation: 11 Joined: 02/17/13 Last Seen: January 23, 2018 Share Posted June 29, 2014 I wanted to enable the anti-flooding in chat. I used this code: (credits to Ai4rei) (http://www.eathena.ws/board/index.php?s=&showtopic=242003&view=findpost&p=1319428) Find: CODE //If type is 2 and the ids don't match, this is a crafted hacked packet! //Disabled because clients keep self-muting when you give players public @ commands... [Skotlex] if (type == 2 /* && (pc_isGM(sd) > 0 || sd->bl.id != id)*/) return; dstsd = map_id2sd(id); if( dstsd == NULL ) return; if( (level = pc_isGM(sd)) > pc_isGM(dstsd) && level >= get_atcommand_level(atcommand_mute) ) { Replace with: CODE //If type is 2 and the ids don't match, this is a crafted hacked packet! //Disabled because clients keep self-muting when you give players public @ commands... [Skotlex] if (type == 2 && (pc_isGM(sd) > 0 || sd->bl.id != id)) return; dstsd = map_id2sd(id); if( dstsd == NULL ) return; if( type == 2 || ( (level = pc_isGM(sd)) > pc_isGM(dstsd) && level >= get_atcommand_level(atcommand_mute) ) ) { It worked, but the problem is it also mutes @commands but commands with "/" is ignored. So I tried to find something that would ignore @commands in the floods. I got this but it does not work: (creidts to CarlosHenrq) (http://www.eathena.ws/board/index.php?s=&showtopic=261885&view=findpost&p=1442337) Index: src/map/clif.c =================================================================== --- src/map/clif.c (revision 14659) +++ src/map/clif.c (working copy) @@ -8845,6 +8845,17 @@ if( is_atcommand(fd, sd, message, 1) ) return; + if( DIFF_TICK(gettick(),sd->t_message) < 3000 ){ // Verify the last message send. Delay message 3s + sd->n_message++; + if(sd->n_message > 10){ // Mute player flooder. + sd->status.manner -= 10; // Punish player with 10 minutes. + sc_start(&sd->bl,SC_NOCHAT,100,0,0); + return; + } + }else if(sd->n_message) // IF have seted var, reduces. + sd->n_message--; + sd->t_message = gettick(); // Set the time of last message. + if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; Index: src/map/pc.c =================================================================== --- src/map/pc.c (revision 14659) +++ src/map/pc.c (working copy) @@ -496,6 +496,7 @@ sd->canlog_tick = gettick(); //Required to prevent homunculus copuing a base speed of 0. sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED; + sd->t_message = sd->n_message = 0; // Mute ignoring atcommand. return 0; } Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 14659) +++ src/map/pc.h (working copy) @@ -158,6 +158,8 @@ struct mmo_charstatus status; struct registry save_reg; + int n_message,t_message; + struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups) short equip_index[11]; unsigned int weight,max_weight; But these codes from CarlosHenrq does not work on mine either. It does not mute anything whether normal chat or @commands. Maybe somebody can give me a proper codes so that my anti-flood muting feature ignores @commands. Thank you guys. Quote Link to comment Share on other sites More sharing options...
Question
johnbond
I wanted to enable the anti-flooding in chat. I used this code: (credits to Ai4rei) (http://www.eathena.ws/board/index.php?s=&showtopic=242003&view=findpost&p=1319428)
It worked, but the problem is it also mutes @commands but commands with "/" is ignored.
So I tried to find something that would ignore @commands in the floods. I got this but it does not work: (creidts to CarlosHenrq) (http://www.eathena.ws/board/index.php?s=&showtopic=261885&view=findpost&p=1442337)
But these codes from CarlosHenrq does not work on mine either. It does not mute anything whether normal chat or @commands.
Maybe somebody can give me a proper codes so that my anti-flood muting feature ignores @commands.
Thank you guys.
Link to comment
Share on other sites
0 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.