Esempio n. 1
0
        void HandleJoin(Player p, string[] args)
        {
            string prefix  = "%dParties> %S";
            string noParty = prefix + "You are not in a party.";

            Team   team   = Team.GetData(p).Team;
            string invite = Team.GetData(p).Invite;

            if (invite == null)
            {
                p.Message(prefix + "You have not been invited to any parties."); return;
            }
            if (team != null)
            {
                p.Message(prefix + "You need to leave your current party before you can join another one."); return;
            }

            team = Team.Find(invite);
            if (team == null)
            {
                p.Message(prefix + "The party you were invited to no longer exists."); return;
            }

            Team.GetData(p).Team   = team;
            Team.GetData(p).Invite = null;

            team.Members.Add(p.name);
            team.Action(p, "joined the party.");
            Team.SaveList();
        }