Example #1
0
        void cmdChatWeapon(BasePlayer player, string command, string[] args)
        {
            if (!useThisEvent)
            {
                SendReply(player, EventMessageErrorNotLaunched);
                return;
            }
            if (!EventStarted)
            {
                SendReply(player, EventMessageErrorNotStarted);
                return;
            }
            BattlefieldPlayer bfplayer = player.GetComponent <BattlefieldPlayer>();

            if (bfplayer == null && !hasAccess(player))
            {
                SendReply(player, EventMessageErrorVoteNotBF);
                return;
            }
            var eventgrounddata = EventGrounds[currentGround] as Dictionary <string, object>;
            var eventgroundkits = eventgrounddata["kits"] as List <object>;

            if (args.Length == 0)
            {
                SendReply(player, string.Format(EventMessageVoteWeaponAvaible, VotePlayersNeeded().ToString()));
                foreach (string kitname in eventgroundkits)
                {
                    SendReply(player, string.Format(EventMessageVoteWeaponVotes, kitname, GetWeaponVotes(kitname).ToString()));
                }
                return;
            }
            string voteweap = args[0];

            if (!eventgroundkits.Contains(voteweap))
            {
                SendReply(player, EventMessageErrorVoteNoKit);
                return;
            }

            if (voteweap == currentWeapon)
            {
                SendReply(player, string.Format(EventMessageErrorVoteAlreadyWeapon, currentWeapon));
                return;
            }

            if (hasAccess(player))
            {
                SetWeapon(voteweap);
                return;
            }

            SendReply(player, string.Format(EventMessageVoteWeaponVoted, voteweap));
            if (WeaponVote[bfplayer] == voteweap)
            {
                return;
            }
            WeaponVote[bfplayer] = voteweap;
            CheckWeaponVotes();
        }
Example #2
0
        void cmdChatGround(BasePlayer player, string command, string[] args)
        {
            if (!useThisEvent)
            {
                SendReply(player, EventMessageErrorNotLaunched);
                return;
            }

            if (!EventStarted)
            {
                SendReply(player, EventMessageErrorNotStarted);
                return;
            }
            BattlefieldPlayer bfplayer = player.GetComponent <BattlefieldPlayer>();

            if (bfplayer == null && !hasAccess(player))
            {
                SendReply(player, EventMessageErrorVoteNotBF);
                return;
            }
            if (args.Length == 0)
            {
                SendReply(player, string.Format(EventMessageVoteGroundAvaible, VotePlayersNeeded().ToString()));
                foreach (KeyValuePair <string, object> pair in EventGrounds)
                {
                    SendReply(player, string.Format(EventMessageVoteGroundVotes, pair.Key, GetGroundVotes(pair.Key).ToString()));
                }
                return;
            }
            string voteground = args[0];

            if (!EventGrounds.ContainsKey(voteground))
            {
                SendReply(player, EventMessageErrorVoteNoGround);
                return;
            }
            if (voteground == currentGround)
            {
                SendReply(player, string.Format(EventMessageErrorVoteAlreadyGround, currentGround));
                return;
            }

            if (hasAccess(player))
            {
                SetGround(voteground);
                return;
            }

            SendReply(player, string.Format(EventMessageVoteGroundVoted, voteground));
            if (GroundVote[bfplayer] == voteground)
            {
                return;
            }
            GroundVote[bfplayer] = voteground;
            CheckGroundVotes();
        }