void RotateQuaternion(float angle_radian, float *quat_w, float *quat_x)
{
*quat_x = -1 * sinf(angle_radian / 2.0f);
*quat_w = cosf(angle_radian / 2.0f);
}
void RotateMeToPlayer(WORD player)
{
stOnFootData ft = SF->getSAMP()->getPlayers()->pLocalPlayer->onFootData; BitStream bs;
actor_info* actorInfo = SF->getSAMP()->getPlayers()->pRemotePlayer[player]->pPlayerData->pSAMP_Actor->pGTA_Ped;
if (actor_info == nullptr) return;
CPed* Ped = GAME->GetPools()->GetPed((DWORD*)actorInfo); CVector pers;
if (Ped == nullptr) return;
Ped->GetTransformedBonePosition(BONE_RIGHTWRIST, &pers);
float angle = -1 * atan2(pers.fX - PEDSELF->GetPosition()->fX, pers.fY - PEDSELF->GetPosition()->fY);
RotateQuaternion(angle, &ft.fQuaternion[0], &ft.fQuaternion[3]);
bs.Write((BYTE)ID_PLAYER_SYNC);
bs.Write((PCHAR)&ft, sizeof(stOnFootData));
SF->getRakNet()->SendPacket(&bs);
}