Jump to content
  • 0

How to ignore @commands in anti-flood?


johnbond

Question


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  457
  • Reputation:   11
  • Joined:  02/17/13
  • Last Seen:  

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.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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...