kralhakan2009 1
kralhakan2009
Vahsi Uzman 1
Vahsi Uzman
farkmt2official 1
farkmt2official
cemalggevenc 1
cemalggevenc
Bvural41 1
Bvural41
yarka0000 1
yarka0000
Hikaye Ekle

Kontrol Ediliyor Get ChatString

  • Konuyu başlatan Konuyu başlatan GOTT.
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 373

Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!

I`m trying to hook TPacketGCChat from a Pserver to get the chat string. Why chat string? Because, on the server, I can use the command /find metin. It search for me on whole map for the nearest metin and send the coordinate in the chat. Thats why I want go get the Chat String and after I got the coordinate, I use "SetPixelPosition" to teleport me to the Metin stone. Thats the code I started with help from the Internet. But I dont know when I inject the dll, how I can use the function to get the coordinate.
PS: I have the key to pack&unpack the whole client. So I have access to python part. Maybe there is a better way instead of hooking the function

C++:
#include "pch.h"
#include "header.h"
#include <iostream>
using namespace std;

static BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

struct TPacketHeader {
    BYTE type;
    WORD size;
};

struct TPacketGCChat
{
    BYTE    header;
    WORD    size;
    BYTE    type;
    DWORD    dwVID;
    BYTE    bEmpire;
};

int (*oldRecv)(int size, char* pDestBuf);

static int WINAPI RecvHook(int size, char* pDestBuf)
{
    TPacketHeader* header = reinterpret_cast<TPacketHeader*>(pDestBuf);
    if (header->size == 4)
    {

        TPacketGCChat* kChat = reinterpret_cast<TPacketGCChat*>(pDestBuf);
        char buf[1024 + 1];
        size_t uChatSize = kChat->size - sizeof(*kChat);
        buf[uChatSize] = '\0';
        strncpy(buf, pDestBuf + sizeof(TPacketGCChat), uChatSize);
        cout << buf << endl;
    }
    return oldRecv(size, pDestBuf);
}
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst