Inheritance: Entity
Exemplo n.º 1
0
 public KickCommand(Player player, string reason)
     : this(player.Name, reason)
 {
 }
Exemplo 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);
        }
Exemplo n.º 3
0
 public KickCommand(Player player)
     : this(player.Name)
 {
 }
Exemplo n.º 4
0
 protected virtual void OnFailure(Player player)
 {
     Server.LogDeveloper("Command failed: {0}", Arguments.Join(' '));
 }
Exemplo n.º 5
0
 protected virtual void OnSuccess(Player player)
 {
     Server.LogDeveloper("Command successful: {0}", Arguments.Join(' '));
 }
Exemplo n.º 6
0
 protected static void WriteLine(Player player, string text)
 {
     Write(player, text + '\n');
 }
Exemplo n.º 7
0
 protected static void WriteLine(Player player, string format, params object[] param)
 {
     WriteLine(player, string.Format(format, param));
 }
Exemplo 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;
 }
Exemplo n.º 9
0
 protected static void Write(Player player, string text)
 {
     if (player == null) {
         Server.Print(text);
     } else {
         player.PrintConsole(text);
     }
 }
Exemplo 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);
 }
Exemplo n.º 11
0
 public virtual void Execute(Player player)
 {
     Server.LogDeveloper("Command executed: {0}", Arguments.Join(' '));
     OnFailure(player.UserID);
 }
Exemplo n.º 12
0
 public void SwearCheck(Player player, Command cmd)
 {
 }
Exemplo 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);
 }
Exemplo 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());
              }
        }
Exemplo 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();
        }
Exemplo n.º 16
0
 public void ClearPlayer(Player player)
 {
     if (knifeonly.Bool()) {
         player.StripUserWeapons();
         player.GiveItem("weapon_knife");
         player.SetMoney(0);
     }
 }