struct stSAMPDialog
{
int iIsActive;
BYTE bDialogStyle;
WORD wDialogID;
BYTE bTitleLength;
char szTitle[257];
BYTE bButton1Len;
char szButton1[257];
BYTE bButton2Len;
char szButton2[257];
char szInfo[257];
};
bool __stdcall InRPC(stRakNetHookParams *hook)
{
if (hook->packetId == RPC_ScrShowDialog)
{
stSAMPDialog sampDialog;
hook->bitStream->Read(sampDialog.wDialogID);
hook->bitStream->Read(sampDialog.bDialogStyle);
hook->bitStream->Read(sampDialog.bTitleLength);
hook->bitStream->Read(sampDialog.szTitle, sampDialog.bTitleLength);
sampDialog.szTitle[sampDialog.bTitleLength] = 0;
hook->bitStream->Read(sampDialog.bButton1Len);
hook->bitStream->Read(sampDialog.szButton1, sampDialog.bButton1Len);
sampDialog.szButton1[sampDialog.bButton1Len] = 0;
hook->bitStream->Read(sampDialog.bButton2Len);
hook->bitStream->Read(sampDialog.szButton2, sampDialog.bButton2Len);
sampDialog.szButton2[sampDialog.bButton2Len] = 0;
SF->getRakNet()->DecodeString(sampDialog.szInfo, 400, hook->bitStream);
// Твой код
}
return true;
}
// в инициализацию mainloop`a
SF->getRakNet()->registerRakNetCallback(RAKHOOK_TYPE_INCOMING_RPC, InRPC);