Message() public method

public Message ( string msg ) : void
msg string
return void
        public void attachplayer(string[] args, Player player)
        {
            if (args.Length < 2)
                {
                    Logger.Log ("not enough arguments: attachplayer(" + String.Join(" ", args) + ", " + player.Name + ")");
                    return;
                }

                string what = args[0];
                string where = args[1];

                Logger.Log (String.Format("Attaching {0} to {1}'s {2}", what, player.Name, where));

                BaseEntity attached = (BaseEntity)GlobalData[string_attachedEntities + player.SteamID];

                if (attached != null)
                {
                    player.Message("You already have an object attached to you!");
                }
                else
                {
                    BaseEntity attach = AttachToPlayer(player, what, where, true);
                    GlobalData [string_attachedEntities + player.SteamID] = attach;
                }

                player.Message("Attach to player executed");
        }
 public void spawn(String[] args, Player player)
 {
     string entity = args[0];
     int count;
     bool success = int.TryParse(args[1], out count);
     if (!success)
         count = 1;
     Vector3 loc2 = player.Location;
     Vector3 lookpos = player.GetLookPoint();
     float dist = Util.GetVectorsDistance(loc2, lookpos);
     if (dist > 50.0)
     {
         player.Message("Distance is too far from your current location. Please look where you want it to spawn");
     }
     else
     {
         Vector3 loc = lookpos;
         spawnit(entity, loc, count);
     }
 }
        public void On_PlayerConnected(Player player)
        {
            if (Welcome)
            {
                player.Message("Welcome " + player.Name + "!");
                foreach (string arg in WelcomeMessage)
                {
                    if (arg != null)
                    {
                        player.Message(arg);
                    }
                }
            }
            if (player.Admin && UpdateAvailable)
            {
                player.Message("There is an update for Pluton available!");
            }
            else if (player.Admin)
            {
                player.Message("There is no update for Pluton available.");
            }

            if (NoVacBans && !player.Admin)
            {
                var pID = player.GameID;
                try
                {
                    var getjson = JSON.Object.Parse(Web.GET(string.Format(apiurl, apikey, pID))).GetObject("players").GetInt("NumberOfVACBans");
                    var count = getjson;
                    if (count >= MaxVacBans)
                    {
                        player.Kick("You have too many Vac Bans!");
                    }
                    //debug
                    Server.BroadcastFrom("NoVacBans", "Player " + player.Name + " has " + count + " on file.");
                }
                catch (Exception e)
                {
                    Pluton.Logger.LogException(e);
                }
            }
        }
 public void On_PlayerConnected(Player player)
 {
     player.Message ("Spawn in Entities and Animals! Type /spawnhelp for more help");
 }
        public void Permission(string[] args, Player player)
        {
            //var groups = JSON.Object.Parse(json_perms).GetObject("groups");
            var players = JSON.Object.Parse(json_perms).GetObject("players");

            if (HasPermission(player.GameID, "permission"))
            {
                if (args.Length >= 3)
                {
                    //Add Permissions
                    if (args[0].ToLower() == "add")
                    {
                        //addto players
                        if (args[1].ToLower() == "player")
                        {
                            //get player
                            Player oplayer = Player.Find(string.Join(" ", args[2]));
                            if (oplayer != null)
                            {
                                var pID = oplayer.GameID.ToString();
                                if (!players.ContainsKey(pID))
                                {
                                    //players[-1].Array[-1] = pID;
                                    players[pID].Array[0] = oplayer.Name;
                                    players[pID].Obj["Groups"].Array[0] = "Default";
                                    players[pID].Obj["Permissions"].Array[0] = null;
                                }
                                if (args[2].ToLower() == "groups")
                                {
                                    if (args[3] != null)
                                    {
                                        //need to add check if already contains value in array
                                        foreach (Value array in players[pID].Obj["Groups"].Array)
                                        {
                                            if (array.ToString() == args[3])
                                            {
                                                player.Message("Error: This Already Contains" + args[3]);
                                                return;
                                            }
                                        }
                                        players[pID].Obj["Groups"].Array[-1] = args[3];
                                        player.Message("The Permissions group:" + args[3] + " has been added to player: " + oplayer.Name);
                                        return;
                                    }

                                }

                            }
                            player.Message("Can't find player: " + string.Join(" ", args));
                            return;
                        }
                        //create/addto groups
                        if (args[1].ToLower() == "group")
                        {

                        }
                    }
                    //Remove Permissions
                    if (args[0] == "remove")
                    {

                    }
                }
                else
                {
                    player.Message(example);
                }
            }
        }
Example #6
0
        // chat.say().Hooks.Chat()
        public static void Command(ConsoleSystem.Arg arg)
        {
            Player player = new Player(arg.Player());

            string[] args = arg.ArgsStr.Substring(2, arg.ArgsStr.Length - 3).Replace("\\", "").Split(new string[] { " " }, StringSplitOptions.None);

            Command cmd = new Command(player, args);

            if (cmd.cmd == "")
            {
                return;
            }

            if (Config.GetBoolValue("Commands", "enabled"))
            {
                if (cmd.cmd == Config.GetValue("Commands", "ShowMyStats"))
                {
                    PlayerStats stats = player.Stats;
                    player.Message(String.Format("You have {0} kills and {1} deaths!", stats.Kills, stats.Deaths));
                    player.Message(String.Format("You have taken {0} dmg, and caused {1} in total!", stats.TotalDamageTaken, stats.TotalDamageDone));
                    return;
                }
                if (cmd.cmd == Config.GetValue("Commands", "ShowStatsOther"))
                {
                    Player pOther = Player.Find(String.Join(" ", cmd.args));
                    if (pOther != null)
                    {
                        PlayerStats stats2 = pOther.Stats;
                        player.Message(String.Format("You have {0} kills and {1} deaths!", stats2.Kills, stats2.Deaths));
                        player.Message(String.Format("You have taken {0} dmg, and caused {1} in total!", stats2.TotalDamageTaken, stats2.TotalDamageDone));
                        return;
                    }
                    player.Message("Can't find player: " + String.Join(" ", cmd.args));
                    return;
                }
                if (cmd.cmd == Config.GetValue("Commands", "ShowLocation"))
                {
                    player.Message(player.Location.ToString());
                    return;
                }
                if (cmd.cmd == Config.GetValue("Commands", "ShowOnlinePlayers"))
                {
                    string msg = Server.GetServer().Players.Count == 1 ? "You are alone!" : String.Format("There are: {0} players online!", Server.GetServer().Players.Count);
                    player.Message(msg);
                    return;
                }
                if (cmd.cmd == Config.GetValue("Commands", "Help"))
                {
                    foreach (string key in Config.PlutonConfig.EnumSection("HelpMessage"))
                    {
                        player.Message(Config.GetValue("HelpMessage", key));
                    }
                }
            }
            OnCommand.OnNext(cmd);

            if (cmd.ReplyWith != "")
            {
                arg.ReplyWith(cmd.ReplyWith);
            }
        }
        public void detach(string[] args, Player player)
        {
            BaseEntity attached = (BaseEntity)GlobalData[string_attachedEntities + player.SteamID];
                BaseEntity attached2 = (BaseEntity)GlobalData[string_EntitiesWithAttachments + player.SteamID];

                if (args[0] == "all")
                {
                    if (attached != null)
                    {
                        attached.Kill();
                        GlobalData.Remove(string_attachedEntities + player.SteamID);
                    }
                    if (attached2 != null)
                    {
                        attached2.Kill();
                        GlobalData.Remove(string_EntitiesWithAttachments + player.GameID);
                        player.Message("All Created Entities Destroyed");
                    }
                }else{
                BaseEntity isattached = (BaseEntity)DataStore.Get("attached", player.SteamID);
                if (isattached == null)
                    Util.DestroyEntity(isattached);
                else
                    player.Message("You dont have anything attached!");
                player.Message("Deattach from player executed");
            }
 public void test(string[] args, Player player)
 {
 BaseEntity attached = AttachToPlayer(player, "weapons/melee/boneknife_wm", "head", true);
 player.Message("Attached entity to your head!");
 DataStore.Add("attached", player.SteamID, attached);
 }
            public void attachtoanimal(string[] args, Player player)
            {
                if (args.Length < 3)
                {
                    Logger.Log ("not enough arguments: attachtoanimal(" + String.Join(" ", args) + ", " + player.Name + ")");
                    return;
                }

                string animal = args [0];
                string what = args [1];
                string where = args [2];
                BaseEntity attached = (BaseEntity)GlobalData [string_EntitiesWithAttachments + player.SteamID];
                if (attached != null)
                {
                    player.Message ("You already have an animal with attachments!");
                }
                else
                {
                    BaseEntity animale = World.SpawnAnimal (animal, player.Location);
                    BaseEntity attacheds = AttachToEntity (animale, what, where, true);
                    GlobalData [string_EntitiesWithAttachments + player.SteamID] = attacheds;
                }
                player.Message ("attach to animal executed");
            }