public override void Use(Player p, string message, CommandData data)
        {
            string[] args = message.SplitSpaces(1);
            if (args.Length == 0)
            {
                Help(p);
            }
            else
            {
                string map = Matcher.FindMaps(p, args[0]);
                if (map == null)
                {
                    return;
                }
                List <string[]> mRows = Database.GetRows("FavouriteMaps", "Name, Map", "WHERE Name=@0", p.truename);

                if (mRows.Count == 0)
                {
                    Database.AddRow("FavouriteMaps", "Name, Map", p.truename, map);
                    p.Message("%SYou set your favourite map to %b" + map + "%S.");
                    return;
                }

                else
                {
                    Database.UpdateRows("FavouriteMaps", "Map=@1", "WHERE NAME=@0", p.truename, map);
                    p.Message("%SYou changed your favourite map to %b" + map + "%S.");
                    return;
                }
            }
        }
Exemple #2
0
        static bool GotoMap(Player p, string name)
        {
            Level lvl = LevelInfo.FindExact(name);

            if (lvl != null)
            {
                return(GotoLevel(p, lvl));
            }

            if (Server.Config.AutoLoadMaps)
            {
                string map = Matcher.FindMaps(p, name);
                if (map == null)
                {
                    return(false);
                }

                lvl = LevelInfo.FindExact(map);
                if (lvl != null)
                {
                    return(GotoLevel(p, lvl));
                }
                return(LoadOfflineLevel(p, map));
            }
            else
            {
                lvl = Matcher.FindLevels(p, name);
                if (lvl == null)
                {
                    p.Message("There is no level \"{0}\" loaded. Did you mean..", name);
                    Command.Find("Search").Use(p, "levels " + name);
                    return(false);
                }
                return(GotoLevel(p, lvl));
            }
        }