コード例 #1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            IRocketPlayer p = (IRocketPlayer)UnturnedPlayer.FromName(command[3]);

            if (p == null)
            {
                UnturnedChat.Say(caller, "player not found!");
                return;
            }

            if (EffectRepeater.Instance.activeThreads.ContainsKey(p.Id))
            {
                UnturnedChat.Say(caller, p.DisplayName + " already has a effect on them!");
                UnturnedChat.Say(caller, "use /killeffect " + "\"" + p.DisplayName + "\" to stop their effect");
                return;
            }

            //int times;
            //double delay;
            //ushort id;

            effectData eD = new effectData();

            int.TryParse(command[0], out eD.TimeToPlay);
            double.TryParse(command[1], out eD.Delay);
            ushort.TryParse(command[2], out eD.Id);
            eD.IRocketPlayer = p;

            EffectRepeater.Instance.StartThread(eD);
            UnturnedChat.Say(caller, "added effect " + eD.Id.ToString() + " to " + p.DisplayName + " with interval of " + eD.Delay.ToString() + " for " + eD.TimeToPlay.ToString() + " times!");
        }
コード例 #2
0
        public void StartThread(effectData eD)
        {
            Thread t = null;

            t = new Thread(() => AddEffectPlayer(eD.IRocketPlayer, eD.TimeToPlay, eD.Delay, eD.Id, DateTime.Now, t));
            t.Start();
            activeThreads.Add(eD.IRocketPlayer.Id, t);
        }