Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Помогите правильно прочесть пешую синхру, я с раксампа попробовал состряпать что-то схожее в плагине но результаты обнадеживают(
На выходе: ID: 34 | Health: 0.0 | Armour: 0.0 | Weapon: 28437720
C++:
bool __stdcall PacketHook(stRakNetHookParams *hook)
{
if (hook->packetId == ID_PLAYER_SYNC)
{
stOnFootData foot; ZeroMemory(&foot, sizeof(foot));
BitStream bsPlayerSync(hook->bitStream->GetData(), hook->bitStream->GetNumberOfBitsUsed() / 8, false);
uint16_t SenderID; bool bHasLR, bHasUD; bool bHasSurfInfo, bAnimation;
bsPlayerSync.IgnoreBits(8);
bsPlayerSync.Read(SenderID);
if (SenderID == targetID)
{
bsPlayerSync.Read(bHasLR);
if (bHasLR) bsPlayerSync.Read(foot.sLeftRightKeys);
bsPlayerSync.Read(bHasUD);
if (bHasUD) bsPlayerSync.Read(foot.sUpDownKeys);
bsPlayerSync.Read(foot.sKeys);
bsPlayerSync.Read((char*)foot.fPosition, sizeof(float) * 3);
bsPlayerSync.Read((char*)foot.fQuaternion, sizeof(float) * 4);
BYTE byteHealthArmour;
BYTE byteHealth, byteArmour;
BYTE byteArmTemp = 0, byteHlTemp = 0;
bsPlayerSync.Read(byteHealthArmour);
byteArmTemp = (byteHealthArmour & 0x0F);
byteHlTemp = (byteHealthArmour >> 4);
if (byteArmTemp == 0xF) byteArmour = 100;
else if (byteArmTemp == 0) byteArmour = 0;
else byteArmour = byteArmTemp * 7;
if (byteHlTemp == 0xF) byteHealth = 100;
else if (byteHlTemp == 0) byteHealth = 0;
else byteHealth = byteHlTemp * 7;
foot.byteHealth = byteHealth;
foot.byteArmor = byteArmour;
bsPlayerSync.Read(foot.byteCurrentWeapon);
bsPlayerSync.Read(foot.byteSpecialAction);
bsPlayerSync.Read((char*)foot.fMoveSpeed, sizeof(float) * 3);
bsPlayerSync.Read(bHasSurfInfo);
if (bHasSurfInfo)
{
bsPlayerSync.Read(foot.sSurfingVehicleID);
bsPlayerSync.Read((char*)foot.fSurfingOffsets, sizeof(float) * 3);
}
else foot.sSurfingVehicleID = -1;
bsPlayerSync.Read(bAnimation);
if (bAnimation)
{
bsPlayerSync.Read(foot.sCurrentAnimationID);
bsPlayerSync.Read(foot.sAnimFlags);
}
else
{
foot.sCurrentAnimationID = 0;
foot.sAnimFlags = 0;
}
SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(245, 184, 0),
"ID: %d | Health: %.1f | Armour: %.1f | Weapon: %d", SenderID, foot.byteHealth, foot.byteArmor, foot.byteCurrentWeapon);
}
}
return true;
}