Players getting hurt when trying to teleportSolved
#1 if do simple teleport with baseplayer.Teleport(newPos) :
if newPos.y > fromTp.y then player getting fall hurt
need use with recieve Snapshot for normal teleport
#2 if do teleport with recieve Snapshot:
if tp from cargoship (parent!=null) then player flying on map with cargoship movement

how do nice teleport ?
now I match parentEntity of player and use 1 or 2 variant
It's starts with update

Merged post

all teleport plugins have it's issue too after update
you could never tp from cargoship  or to. anything moving will kill the player as it's trying to get the position and while your moving its always updating
Kitty87
you could never tp from cargoship  or to. anything moving will kill the player as it's trying to get the position and while your moving its always updating
player.SetParent(null, true, false);
It's worked before last update.

old worked code:
            player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true);
            if (!BasePlayer.sleepingPlayerList.Contains(player))
                BasePlayer.sleepingPlayerList.Add(player);
            player.CancelInvoke("InventoryUpdate");       
     
            player.Teleport(position);
            player.SetParent(null, true, false);
            player.SendNetworkUpdate();
            if (player.net?.connection != null)
                player.SetPlayerFlag(BasePlayer.PlayerFlags.ReceivingSnapshot, true);
            player.UpdateNetworkGroup();
            player.SendNetworkUpdateImmediate(false);
            if (player.net?.connection == null) return;
            try { player.ClearEntityQueue(null); } catch { }
            player.SendFullSnapshot();​
my suggestion would be to make player godmode whilst teleporting,
float healthBeforeTP = player.health;
            while(player.isInAir) {
                player.health = player._maxHealth;
            }
            if(player.IsOnGround()) {
                player.health = healthBeforeTP;
            }​


Above is an example, and not sure if it would work. 

That being said, I know previously sleeping players didnt get fall damage, not sure if that bug would be fixed, so this could also work just before teleport: 

player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true);
Pho3niX90
my suggestion would be to make player godmode whilst teleporting,
float healthBeforeTP = player.health;
            while(player.isInAir) {
                player.health = player._maxHealth;
            }
            if(player.IsOnGround()) {
                player.health = healthBeforeTP;
            }​

Above is an example, and not sure if it would work. 

That being said, I know previously sleeping players didnt get fall damage, not sure if that bug would be fixed, so this could also work just before teleport: 

player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true);
You are trying to fix consequences instead of reason, its not the best practice


Also any bug, any issue. And then player will always have godmode and go and raid other players.... 

I have same problem. When I teleport player, if prefab is not full loaded, player died by fall. 

have your resolve your issue ?

i just add 1 or 2 to the y coord to lift end location a little higher than ground but that creates a new problem when tp into bases...... so will be interested in the sulutions here

Merged post

it seems the problem is the prefabs not loading if fast for client ..... and that speed wil be different depending on few factors on client side ... i know this is not the best way but what if you tp to location just undermap , freeze player wait 2sec or more and then allow tp to location that way prefabs can load  while player is close and then allow smooth landing ....

and yes i know this is not the right way just thinking of a way to slow tp down for client side loading
5ba216a6d7f65.png Orange
You are trying to fix consequences instead of reason, its not the best practice

Also any bug, any issue. And then player will always have godmode and go and raid other players.... 
Something like this wouldnt cause the issues you mention:
player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true)

and this: 
float healthBeforeTP = player.health;
            while(player.isInAir) {
                player.health = player._maxHealth;
            }
            if(player.IsOnGround()) {
                player.health = healthBeforeTP;
            }​
will end, if it fails it will just not set the health max anymore? worst case scenario is that the player will have more on the other point at what he started with. I cannot see any failure points where they will have perma god mode.  

Again, these were suggestions, as I do not use TP on any of my servers I have no skin in the game, was merely trying to help.
Pho3niX90
Something like this wouldnt cause the issues you mention:
player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true)

and this: 
float healthBeforeTP = player.health;
            while(player.isInAir) {
                player.health = player._maxHealth;
            }
            if(player.IsOnGround()) {
                player.health = healthBeforeTP;
            }​
will end, if it fails it will just not set the health max anymore? worst case scenario is that the player will have more on the other point at what he started with. I cannot see any failure points where they will have perma god mode.  

Again, these were suggestions, as I do not use TP on any of my servers I have no skin in the game, was merely trying to help.

I see you like "while" and locking server thread. Also for sure he will be wounded, so one more thing you need to check...

To solve the problem I had used a temporary noclip added to a freeze.
But I found that it was masking a problem.

So to solve the problem:
- Add the player to the sleeper list.
- Move the player
what about looping a timer on checking if player is on ground every second...... just thinking

[Command("TP")]
		private void tpCommand(IPlayer iplayer, string command, string[] args)
		{
			BasePlayer player = iplayer.Object as BasePlayer;

			float healthBeforeTP = player.health;
			player.Teleport(x.y.z);
			CheckTPstatus(player,healthBeforeTP);


		}

		void CheckTPstatus(BasePlayer player, float healthBeforeTP)
		{
			
			if (!player.IsFlying)
			{
				player.health = player._maxHealth;
				timer.Once(1f, () =>
				{
					if (player.isInAir)
					{
						CheckTPstatus(player,healthBeforeTP);
					}
					if (player.IsOnGround())
					{
						player.health = healthBeforeTP;
					}
				});

			}
		}​
so you gona use that plugin rather?
Locked automatically