server.Command("tp 1815 10 1518");
how do i make that teleport the player that runs the command, as in how do i get there name automatically?
how do i make that teleport the player that runs the command, as in how do i get there name automatically?
[Command("tp")]
private void TeleportCommand(IPlayer player, string command, string[] args)
{
player.Teleport(1815, 10, 1518);
player.Reply($"Hi {player.Name}, you were teleported to: 1815 10 1518");
} [Command("tp")]
private void CommandTeleport(IPlayer player, string command, string[] args)
{
// Only let players run this command
if (player.IsServer)
return;
// Parse arguments
float x, y, z;
if (args.Length < 3 ||
!float.TryParse(args[0], out x) ||
!float.TryParse(args[1], out y) ||
!float.TryParse(args[2], out z))
{
player.Reply("Syntax: tp <x> <y> <z>");
return;
}
player.Teleport(x, y, z);
}There are other considerations as well. For instance, if they are going far, you'll probably want to put them asleep to allow their surroundings to load first. You can check out the NTeleportation plugin which does this. WhiteThunder
There are other considerations as well. For instance, if they are going far, you'll probably want to put them asleep to allow their surroundings to load first. You can check out the NTeleportation plugin which does this.
I'm not sure that's needed. From my experience and testing, Covalence handles all that is necessary. See https://github.com/OxideMod/Oxide.Rust/blob/develop/src/Libraries/Player.cs#L189-L226