• 0
Sign in to follow this  
Followers 0
Myriad

What is causing my plugin to break?

Question

Hello!

I made this plugin so I can bring in a pull request to my server. It compiles fine and the server starts as well. However, the plugin actually breaks the server and makes it so I can't login. I know the code is fine as I tested by adding to clif.c before making it plugin form.
How can I fix it?

Thank you.
 

bool clif_send_pre(const void **buf, int *len, struct block_list **bl, enum send_target *type)
{
    struct map_session_data *sd;
	    if (*type != ALL_CLIENT)
        nullpo_ret(*bl);
	    sd = BL_CAST(BL_PC, *bl);
    // Hide Area Packets from hidden players https://github.com/HerculesWS/Hercules/pull/1200
    if (sd != NULL && pc_isinvisible(sd))
    {
        if (*type == AREA || *type == BG || *type == BG_AREA)
            *type = SELF;
        else if (*type == AREA_WOS || *type == BG_WOS || *type == BG_AREA_WOS)
            hookStop();
            return true;
    }
    hookStop();
    return true;
}
/* run when server starts */
HPExport void plugin_init (void)
{
    addHookPre(clif, send, clif_send_pre);
}
Edited by Myriad

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

You should change *type as you doing and not blocking call to default function.

This mean your plugin will change incoming parameters for default clif_send function.

 

Share this post


Link to post
Share on other sites
  • 0

You calling hookStop in all cases, this mean you always blocking clif_send. And this mean server cant send any packets.

 

Share this post


Link to post
Share on other sites
  • 0
15 hours ago, 4144 said:

You should change *type as you doing and not blocking call to default function.

This mean your plugin will change incoming parameters for default clif_send function.

 

edit: wrong post

Edited by melv0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0