Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C# by MasterCassim ( 15 years ago )
[CommandGroup("port", "Transfers the character to an other world.")]
    public class PortalCommand : CommandGroup
    {
        [DefaultCommand]
        public string Portal(string[] @params, MooNetClient invokerClient)
        {
            if (invokerClient == null)
                return "You can not invoke this command from console.";

            if (invokerClient.InGameClient == null)
                return "You can only invoke this command while ingame.";

            if (@params != null && @params.Count() > 0)
            {

                Mooege.Core.GS.Map.World world;
                try
                {
                    world = invokerClient.InGameClient.Player.World.Game.GetWorld(Convert.ToInt32(@params[0]));
                }
                catch (System.FormatException e) {
                    return "The argument is not a world id.";
                }

                if (world == null)
                {
                    return "We can't handle this world yet!";
                }

                invokerClient.InGameClient.Player.TransferTo(world, world.SpawnableScenes.First().StartPosition);
                return "Ported!";
            }

            return "Invalid arguments. Type 'help port' to get help.";
        }
    }

 

Revise this Paste

Your Name: Code Language: