Inheritance: Entity
Esempio n. 1
0
 public KickCommand(Player player, string reason)
     : this(player.Name, reason)
 {
 }
Esempio n. 2
0
        /// <summary>
        /// This function is used internally.
        /// It executes all needed handlers when a specific command occures.
        /// </summary>
        /// <param name="str">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="cmd">
        /// A <see cref="Command"/>
        /// </param>
        internal static void Execute(Player player, Command cmd)
        {
            foreach (KeyValuePair<string, ClientCommandDelegate> keyval in events) {
                if (cmd.ToString().StartsWith(keyval.Key)) {
                    if (keyval.Value != null) {
                        keyval.Value(player, cmd);
                    }
                }
            }

            cmd.Execute(player);
        }
Esempio n. 3
0
 public KickCommand(Player player)
     : this(player.Name)
 {
 }
Esempio n. 4
0
 protected virtual void OnFailure(Player player)
 {
     Server.LogDeveloper("Command failed: {0}", Arguments.Join(' '));
 }
Esempio n. 5
0
 protected virtual void OnSuccess(Player player)
 {
     Server.LogDeveloper("Command successful: {0}", Arguments.Join(' '));
 }
Esempio n. 6
0
 protected static void WriteLine(Player player, string text)
 {
     Write(player, text + '\n');
 }
Esempio n. 7
0
 protected static void WriteLine(Player player, string format, params object[] param)
 {
     WriteLine(player, string.Format(format, param));
 }
Esempio n. 8
0
 /// <summary>
 /// Emulates a player calling a command.
 /// </summary>
 /// <param name="p">
 /// Instance of the player <see cref="Player"/>
 /// </param>
 public void FakeCall(Player p)
 {
     overrideArguments = true;
     instance = this;
     MetaModEngine.dllapiFunctions.ClientCommand(p.Pointer);
     instance = null;
     overrideArguments = false;
 }
Esempio n. 9
0
 protected static void Write(Player player, string text)
 {
     if (player == null) {
         Server.Print(text);
     } else {
         player.PrintConsole(text);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Updates the two dproto variables according to the player.
 /// </summary>
 /// <param name="player">
 /// The information about this player <see cref="Player"/>
 /// </param>
 public static void UpdateCVariables(Player player)
 {
     UpdateCVariables(player.Index);
 }
Esempio n. 11
0
 public virtual void Execute(Player player)
 {
     Server.LogDeveloper("Command executed: {0}", Arguments.Join(' '));
     OnFailure(player.UserID);
 }
Esempio n. 12
0
 public void SwearCheck(Player player, Command cmd)
 {
 }
Esempio n. 13
0
 void HandleSayExec(Player player, Command command)
 {
     // Ommit /exec and execute the following text
       string exec_string = command.Arguments[1].Split(' ').Shift().Join(' ') + ";";
       EvaluateGoldSrc(player, exec_string);
 }
Esempio n. 14
0
        /// <summary>
        /// This function evaluates a piece of code and prints the output linewise to the chat of the player
        /// </summary>
        /// <param name="p">
        /// A player instance <see cref="Player"/>
        /// </param>
        /// <param name="code">
        /// A command <see cref="System.String"/>
        /// </param>
        protected virtual void EvaluateGoldSrc(Player p, string code)
        {
            bool result_set;
              object result;

              try
              {
            Evaluator.Evaluate(code, out result, out result_set);
            if (result_set)
            {
              System.IO.TextWriter tw = new System.IO.StringWriter();
              PrettyPrint(tw, result);

              p.ClientPrintEachLine(tw.ToString());
            }
              }
              catch (Exception e)
              {
            p.ClientPrintEachLine(e.ToString());
              }
        }
Esempio n. 15
0
        public void SendMessage(Player player, float time)
        {
            Message.Begin(MessageDestination.OneReliable, Message.GetUserMessageID("TextMsg"), IntPtr.Zero, player.Pointer);
            Message.WriteByte(4);
            Message.WriteString("#Game_will_restart_in");
            Message.WriteString(time.ToString());
            Message.WriteString("SECOND");
            Message.End();

            Message.Begin(MessageDestination.OneReliable, Message.GetUserMessageID("TextMsg"), IntPtr.Zero, player.Pointer);
            Message.WriteByte(2);
            Message.WriteString("#Game_will_restart_in_console");
            Message.WriteString(time.ToString());
            Message.WriteString("SECOND");
            Message.End();
        }
Esempio n. 16
0
 public void ClearPlayer(Player player)
 {
     if (knifeonly.Bool()) {
         player.StripUserWeapons();
         player.GiveItem("weapon_knife");
         player.SetMoney(0);
     }
 }