I can try to walk you through my mental process writing a simple plugin... I wanted to get a notification when a particular mob spawned (epic drop). Because I suffer from some of the typical software engineer mental deficiencies I decided the best course of action was to roll my own before I bothered looking at what wheels were already invented & waiting for me to use them :p.
So I dug around the mq2 website/wiki to find the links I provided above.
Got MQ2 to compile in vs2015.
Generated a stub plugin; got it to compile in vs2015.
Decided I was basically in a
legacy code situation. Meaning I'm going to need to figure out a lot of tedious BS without anyone to really ask questions to with a reasonable turn around time. I mean, technically, eqmule is on here and there are other people here who have written plugins. On the other hand I can't just hit them up & ask them if they want to get beers and let me pick their brain :p.
Looked through the stub methods available to me within my plugin. OnAddSpawn looked like the most promising method name & comments. I don't trust comments. Comments are dirty filthy liars (not a commentary on mq2... just professional paranoia that has saved my ass on a number of occasions). So I looked up all references within my project to OnAddSpawn (shift-F12 or some crap? I usually use eclipse not visual studio).
I found where MQ2 calls OnAddSpawn. Great run of the mill
observer pattern (more or less... dll loading instead of registerObserver method etc). Also noted no apparent concurrency. Mental note to not do anything slow within my event handler. Secondary mental note to worry later, when/if it's relevant, if mq2 is thread-safe and how badly I could screw things up forking off threads on events instead of handling them inline.
So anyway, that told me that OnAddSpawn did indeed look like a promising place to put my garbage. I slapped a few lines of code into there, compiled, loaded the plugin, & it worked. Hurray.
I didn't look at all at HUD drawing until you posted this. I think you want to look at "OnDrawHUD" & maybe look at the MQ2HUD source code that came with mq2.
EDIT here & below:
Forgot to throw in the "i don't know wtf I'm talking about" caveat. I've played with MQ2 sources for like 3-ish hours tops.
So I guess the TL;DR take away I have so far is that MQ2 is essentially an event-driven observer/observable architecture where plugins are the observers. That means that anything you do in a plugin needs to happen when one of these events occurs.
I suppose the exception to that would be that you could probably do some stuff like fork a thread to run when the plugin is initialized & then set a variable during unload that will terminate that thread cleanly etc. Like if you need to do things at random times unrelated to what MQ2 is doing. Caveats about the thread safety of mq2 (which I have no idea). Guessing the MQ2IRC thing must do something along these lines.