Send attack function doesnt do anything

06/10/2021 10:43 mildegusti#1
Hello guys, i have a problem with my c++ code - it does not do anything ingame :reeee: i say that i pass all the values correctly but no hit no nothing

That's the code:

DWORD baseaddr =(DWORD)GetModuleHandleW(NULL);
DWORD GetTargetVID = (*(DWORD*)(baseaddr+0x2B1540)+(0x17FCC));
DWORD mode = 0x0;
DWORD network =(DWORD)(baseaddr + 0x2AE584);

void SendAttackPacket(void* pthis, const DWORD mode, const DWORD vid)
{
typedef char(__thiscall* tSendAttackPacket)(void* pthis, DWORD uMotAttack, DWORD dwVIDVictim);
tSendAttackPacket SendAttackPacket = (tSendAttackPacket)(baseaddr+0xA7F80);


}
void Main()
{
while (true)
{
//Here i check the values of the target and CNetworkInstance to see if it matches with values from cheat engine
if (GetAsyncKeyState(VK_NUMPAD1))
{

cout << "target: " << *(DWORD*)GetTargetVID << endl;
cout << "network: " << *(DWORD*)network << endl;
Sleep(1000);
}

SendAttackPacket((void*)(*(DWORD*)network), mode, (*(DWORD*)GetTargetVID));
Sleep(100);

I'm happy to hear your suggestions
06/10/2021 11:02 Aeryas#2
First, you need to be close to the target, as it requires you to be in melee range.
Second: I'm not sure that the dereference is done correctly in the GetTargetVID. I never understood pointers, so I might be wrong.
Third: if you play on a server that has the attack speed fixed, you should increase the sleep timer to like 200 to test it out ( depends on the class you're playing, the attack speed you have and also depends if you're mounted or not. Better make it dynamic, so you can adjust it on the fly and test it out on which speed it does work.

Cheers.
06/10/2021 11:17 mildegusti#3
Thanks for the answer!

I put my char as close as i could've been with the target (even used wallhack) as for the sleep timer i also put 1000 ms and nothing.
I think the VID of the mob is passed correctly as i mentioned above i looked it up on the stack in cheat engine and in c++ --> in this image
[Only registered and activated users can see links. Click Here To Register...]
06/10/2021 13:03 HelloBrightness#4
[Only registered and activated users can see links. Click Here To Register...]
09/17/2021 02:17 badforce788#5
DWORD sendbattleattackpacket = 0x0;
DWORD cpythonnetworkstream = *(DWORD*)0x0;

typedef void(__thiscall* sendattack)(DWORD cpythonnetworkstream, UINT attack, DWORD vid);
sendattack sendattackpacket = (sendattack)sendbattleattackpacket;

DWORD gettarrgetvid = *(DWORD*)(*(DWORD*)(0x0) + 0x0);
sendattackpacket(cpythonnetworkstream, 0, gettarrgetvid);


i think you can do it like this!
09/17/2021 20:45 trashepvp#6
Just to say that some retarded and autist admins from Metin2 servers (all Metin2 admins are like it but you got the idea), they add a IsAttacking check inside the SendAttackPacket call, so check SendAttackPacket in your server to see the conditions inside it and, if needed, patch this crappy first.

Btw, its not char, its bool:
typedef char(__thiscall* tSendAttackPacket)(void* pthis, DWORD uMotAttack, DWORD dwVIDVictim);
tSendAttackPacket SendAttackPacket = (tSendAttackPacket)(baseaddr+0xA7F80);

typedef bool(__thiscall* tSendAttackPacket)(void* pthis, DWORD uMotAttack, DWORD dwVIDVictim);
tSendAttackPacket SendAttackPacket = (tSendAttackPacket)(baseaddr+0xA7F80);