Hey! anyone know how to teleport a player to a position & taking you throught the loading screen aswell? Thanks!
Teleporting using the loading screen?
Discussion in 'Rust Development' started by Sonny-Boi, Jan 16, 2018.
-
look into NTeleportation!!
How about next time using the search before asking one on the most requested thing on the forums?? -
I have, ive tired using TeleportToPosition(player, x, y, z) and it returns does not exist in current context.
-
Code:public void TeleportToPlayer(BasePlayer player, BasePlayer target) => Teleport(player, target.transform.position); public void TeleportToPosition(BasePlayer player, float x, float y, float z) => Teleport(player, new Vector3(x, y, z)); public void Teleport(BasePlayer player, Vector3 position) { SaveLocation(player); teleporting.Add(player.userID); if (player.net?.connection != null) player.ClientRPCPlayer(null, player, "StartLoading"); StartSleeping(player); player.MovePosition(position); if (player.net?.connection != null) player.ClientRPCPlayer(null, player, "ForcePositionTo", position); 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(); }
-
thanks man