What I gonna introduce is the async function template comes with c++11.
So, simple sample. Suppose you wanna constantly use one skill, in your SendHook function:
Code:
... int opcode=packet.GetOP(); switch (opcode) { case 0x6987: int skillID=packet.GetElement(0)->int32; if (skillID==AUTO_SKILL) { std::async([]() { Sleep(5000); use_skill(AUTO_SKILL); }); } break; ... } ...
The sample above is the most basic thing async can do. However it's very powerful for writing automated stuff, figure it out.