Jump to content
  • 0
Sign in to follow this  
bWolfie

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

Recommended Posts

  • 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

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

  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  

×
×
  • Create New...

Important Information

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