Onaylı Üye
Arkadaşım için kullanıcam
usta nasıl kullancaz yardımcı olurmusunaktif olarak kullanmaktayım teşekkür ederim
kullanılırMetin2 için kullanılır heralde.
Kodları nasıl kullanacağız hocamher sunucuda çalışırmı ?
__forceinline auto Teleport(Entitity* entity) -> void
{
this->SetPositionInternal(entity->GetPositionInternal());
}
__declspec(noinline) auto CalculateNearest(const std::vector<Entity*> *targets,const bool state_packet = false) -> Entity*
{
Entity* closest_entity = nullptr;
float max_dist = FLT_MAX;
for (const auto &pEntity : targets)
{
if (pEntity->isDead() || pEntity->isInvisible()) continue;
const auto distance_to_local = this->GetDistance(pEntity);
if (!state_packet && distance_to_local > 100.f)
continue;
if (distance_to_local < max_dist)
{
max_dist = distance_to_local;
closest_entity = pEntity;
}
}
return closest_entity;
}
__forceinline auto TeleportToClosest(const std::vector<Entity*> *targets,const bool state_packet = false) -> void
{
if (const auto closest_entity = this->CalculateNearest(targets,send_packet))
{
if (!send_packet){
this->Teleport(closest_entity);
}
else {
const auto dist = this->GetDistance(closest_entity);
if (dist > 300.f){
auto calculated_pick_points = this->CalculatePoints(this,closest_entity);
CPythonNetworkStream::SendCharacterStatePacketIterated(calculated_pick_points,PH_MOVE,10.f);
return;
}
if (CPythonNetworkStream::SendCharacterStatePacket(this,closest_entity,PH_MOVE))
this->Teleport(closest_entity);
}
}
}