Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Server/mods/deathmatch/logic/CMapManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ void CMapManager::SpawnPlayer(CPlayer& Player, const CVector& vecPosition, float

// Update the player data
Player.SetSpawned(true);
Player.SetTeleported(true);
Player.SetHealth(Player.GetMaxHealth());
Player.SetIsDead(false);
Player.SetWearingGoggles(false);
Expand Down
21 changes: 13 additions & 8 deletions Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,20 @@ bool CPlayerPuresyncPacket::Read(NetBitStreamInterface& BitStream)
position.data.vecPosition += vecTempPos;
}

CVector playerPosition = pSourcePlayer->GetPosition();
float playerDistancePosition = DistanceBetweenPoints3D(playerPosition, position.data.vecPosition);
if (playerDistancePosition >= g_TickRateSettings.playerTeleportAlert) {
if (!pSourcePlayer->GetTeleported()) {
CLuaArguments arguments;
pSourcePlayer->CallEvent("onPlayerTeleport", arguments, nullptr);
}
if (position.data.vecPosition.fX != 0.0f && position.data.vecPosition.fY != 0.0f && position.data.vecPosition.fZ != 0.0f)
{
CVector playerPosition = pSourcePlayer->GetPosition();
float playerDistancePosition = DistanceBetweenPoints3D(playerPosition, position.data.vecPosition);
if (playerDistancePosition >= g_TickRateSettings.playerTeleportAlert)
{
if (!pSourcePlayer->GetTeleported())
{
CLuaArguments arguments;
pSourcePlayer->CallEvent("onPlayerTeleport", arguments, nullptr);
}

pSourcePlayer->SetTeleported(false);
pSourcePlayer->SetTeleported(false);
}
}

pSourcePlayer->SetPosition(position.data.vecPosition);
Expand Down
Loading