Alright, here comes a little trick you guys can use to write a pake script.
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;
...
}
...
Note a lambda is passed to async call. What is does is basically send 0x6982 to use the same skill 5 seconds after every time the skill was released, assuming the CD is 5 seconds. You can manually adjust the time to wait.
The sample above is the most basic thing async can do. However it's very powerful for writing automated stuff, figure it out.