I was indeed thinking about storing both the playername and the object, but when the player leaves, is the player object empty or is it kinda there still? If it is still there wasn't there an "IsDestroyed" function where you could see if the object still exists?
I now have this:
I now have this:
if (IsTame()) { if (m_OwnerName == "" && m_OwnerObject == NULL || m_OwnerObject->IsDestroyed()) { class cCallback : public cPlayerListCallback { virtual bool Item(cPlayer * Player) override { OwnerObject = Player; return false; } public: cPlayer * OwnerObject; } Callback; m_World->DoWithPlayer(m_OwnerName, Callback); if (Callback.OwnerObject != NULL) { m_OwnerObject = Callback.OwnerObject; m_OwnerName = m_OwnerObject->GetName(); } } else { Vector3f OwnerCoords = m_OwnerObject->GetPosition(); double Distance = (OwnerCoords - GetPosition()).Length(); if (Distance < 3) { m_bMovingToDestination = false; } else if ((Distance > 30) && (!IsSitting())) { TeleportToCoords(OwnerCoords.x, OwnerCoords.y, OwnerCoords.z); } else { m_Destination = OwnerCoords; } } }But the server crashes when there is a tamed wolf.