- 12
- 2
помогите перевести на клео
inline float vect3_length(const float in[3])
{
return sqrtf(in[0] * in[0] + in[1] * in[1] + in[2] * in[2]);
}
inline void vect3_copy(const float in[3], float out[3])
{
memcpy(out, in, sizeof(float) * 3);
}
void AimVectorToPlayer(WORD player)
{
stAimData aim = SF->getSAMP()->getPlayers()->pLocalPlayer->aimData;
actor_info* actorInfo = SF->getSAMP()->getPlayers()->pRemotePlayer[player]->pPlayerData->pSAMP_Actor->pGTA_Ped;
float matched_pos[3], AimVector[3];
vect3_copy(actorInfo->base.matrix + 12, matched_pos);
float* fPos = actorInfo->base.matrix + 12;
for (int i = 0; i < 3; ++i)
{
AimVector = matched_pos - aim.vecAimPos;
aim.vecAimf1 = AimVector / vect3_length(AimVector);
aim.vecAimPos = fPos;
}
aim.vecAimPos[2] += 0.2f;
BitStream bs;
bs.Write((BYTE)ID_AIM_SYNC);
bs.Write((PCHAR)&aim, sizeof(stAimData));
SF->getRakNet()->SendPacket(&bs);
}
inline float vect3_length(const float in[3])
{
return sqrtf(in[0] * in[0] + in[1] * in[1] + in[2] * in[2]);
}
inline void vect3_copy(const float in[3], float out[3])
{
memcpy(out, in, sizeof(float) * 3);
}
void AimVectorToPlayer(WORD player)
{
stAimData aim = SF->getSAMP()->getPlayers()->pLocalPlayer->aimData;
actor_info* actorInfo = SF->getSAMP()->getPlayers()->pRemotePlayer[player]->pPlayerData->pSAMP_Actor->pGTA_Ped;
float matched_pos[3], AimVector[3];
vect3_copy(actorInfo->base.matrix + 12, matched_pos);
float* fPos = actorInfo->base.matrix + 12;
for (int i = 0; i < 3; ++i)
{
AimVector = matched_pos - aim.vecAimPos;
aim.vecAimf1 = AimVector / vect3_length(AimVector);
aim.vecAimPos = fPos;
}
aim.vecAimPos[2] += 0.2f;
BitStream bs;
bs.Write((BYTE)ID_AIM_SYNC);
bs.Write((PCHAR)&aim, sizeof(stAimData));
SF->getRakNet()->SendPacket(&bs);
}