So, I have coded a cheat that works completely fine in which I can attack by range and pick items by range aswell. The problem is that when I use both at the same time my character keeps flickering and doesn't look as smooth as other professional cheats.
My question is: how to code so both can work properly?
Currently, I create two threads that execute functions for ranged damage and ranged pickup. The code looks something like this:
Code:
void sendAttackWrapper()
{
if(!isPressed(VK_SPACE)) return false;
TPixelPosition mobPos = getPixelPosition(mobVID);
if ((mobPos.x <= 1 or mobPos.y <= 1) or (myPos.x <= 1 or myPos.y <= 1)) return; // checks if mob position is something valid
DWORD instType = getInstanceType(mobVID);
if(instType != 0 and instType != 2) return; // if is not a mob or is not a metin, skip to the next one
float dst = getCharacterDistance(mobVID);
if(dst > args.dst) return; // if distance to the mob is bigger than the maximum distance intended, returns;
WaitForSingleObject(isPlayerAround, INFINITE); // waits if the object is signaled -> only signaled if there's a player around
Teleport(mobPos);
sendAttackPacket(mobVID);
Teleport(playerPos);
}
Is the best approach actually using separate threads? I also thought on putting pickup in between sendAttackPacket and teleport calls, but after the mob is dead, if the player didn't had time to pickup the item, it wouldn't be able to teleport back to that location.
What can I do to stop this flickering?
Thanks






