Hey guys,
i need a perfect way to teleport 20+ players at the same time to a position. It works but one problem. The player that has not loaded the objects / structures falls down and get damage. So what can i do to teleport the baseplayer to a position with structure without falldamage?
Sir
Solved Teleporting group of players and loading objects?
Discussion in 'Rust Development' started by Sir BenSon, Nov 4, 2016.
-
Are you using the technique most other teleport plugins do? Via having them use the loading screen and forcing them to sleep.
Code:public void Teleport(BasePlayer player, Vector3 position) { if (player.net?.connection != null) player.ClientRPCPlayer(null, player, "StartLoading", null, null, null, null, null); StartSleeping(player); player.MovePosition(position); if (player.net?.connection != null) player.ClientRPCPlayer(null, player, "ForcePositionTo", position); player.TransformChanged(); if (player.net?.connection != null) player.SetPlayerFlag(BasePlayer.PlayerFlags.ReceivingSnapshot, true); player.UpdateNetworkGroup(); //player.UpdatePlayerCollider(true, false); player.SendNetworkUpdateImmediate(false); if (player.net?.connection == null) return; //TODO temporary for potential rust bug try { player.ClearEntityQueue(null); } catch { } player.SendFullSnapshot(); }
Code:private void StartSleeping(BasePlayer player) { if (player.IsSleeping()) return; player.SetPlayerFlag(BasePlayer.PlayerFlags.Sleeping, true); if (!BasePlayer.sleepingPlayerList.Contains(player)) BasePlayer.sleepingPlayerList.Add(player); player.CancelInvoke("InventoryUpdate"); //player.inventory.crafting.CancelAll(true); //player.UpdatePlayerCollider(true, false); }
-
Ha best way! Thanks
-