示例#1
0
        private void UnsetPropFlags(BasePlayer player)
        {
            // Change to normal view
            player.SetPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode, false);
            player.SetPlayerFlag(BasePlayer.PlayerFlags.EyesViewmode, false);

            // Restore admin/developer flags
            if (player.net.connection.authLevel > 0)
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, true);
            }
            if (DeveloperList.IsDeveloper(player))
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.IsDeveloper, true);
            }
        }
示例#2
0
        void SetPropFlags(BasePlayer player)
        {
            // Toggle admin/developer flags to allow third-person
            if (player.net.connection.authLevel > 0)
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.IsAdmin, false);
            }
            if (DeveloperList.IsDeveloper(player))
            {
                player.SetPlayerFlag(BasePlayer.PlayerFlags.IsDeveloper, false);
            }

            // Toggle the third-person view
            player.SetPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode, !player.HasPlayerFlag(BasePlayer.PlayerFlags.ThirdPersonViewmode));

            onlinePlayers[player].IsHidden = !onlinePlayers[player].IsHidden;
        }
示例#3
0
        public static void On_Chat(ConsoleSystem.Arg arg)
        {
            if (arg.ArgsStr.StartsWith("\"/") && !arg.ArgsStr.StartsWith("\"/ "))
            {
                On_Command(arg);
                return;
            }

            if (!ConVar.Chat.enabled)
            {
                arg.ReplyWith("Chat is disabled.");
            }
            else
            {
                if (arg.ArgsStr == "\"\"")
                {
                    return;
                }

                BasePlayer basePlayer = arg.Player();
                if (!basePlayer)
                {
                    return;
                }

                ChatEvent pChat = new ChatEvent(Server.GetPlayer(basePlayer), arg);

                string str = arg.GetString(0, "text");

                if (str.Length > 128)
                {
                    str = str.Substring(0, 128);
                }

                if (str.Length <= 0)
                {
                    return;
                }


                if (ConVar.Chat.serverlog)
                {
                    ServerConsole.PrintColoured(new object[] {
                        ConsoleColor.DarkYellow,
                        basePlayer.displayName + ": ",
                        ConsoleColor.DarkGreen,
                        str
                    });
                    ConVar.Server.Log("Log.Chat.txt", string.Format("{0}/{1}: {2}\r\n", basePlayer.userID, basePlayer.displayName, str));
                    Debug.Log(string.Format("[CHAT] {0}: {1}", basePlayer.displayName, str));
                }

                string arg2 = "#5af";
                if (basePlayer.IsAdmin())
                {
                    arg2 = "#af5";
                }

                if (DeveloperList.IsDeveloper(basePlayer))
                {
                    arg2 = "#fa5";
                }

                OnNext("On_Chat", pChat);

                string text2 = string.Format("<color={2}>{0}</color>: {1}", basePlayer.displayName.Replace('<', '[').Replace('>', ']'), pChat.FinalText, arg2);

                if (pChat.FinalText != "")
                {
                    Logger.ChatLog(pChat.BroadcastName, pChat.OriginalText);
                    arg.ReplyWith(pChat.Reply);

                    if (ConVar.Server.globalchat)
                    {
                        ConsoleSystem.Broadcast("chat.add", basePlayer.userID, text2, 1);
                    }
                    else
                    {
                        float num = 2500;
                        foreach (Connection current in Net.sv.connections)
                        {
                            if (current.player != null)
                            {
                                float sqrMagnitude = (current.player.transform.position - basePlayer.transform.position).sqrMagnitude;
                                if (sqrMagnitude <= num)
                                {
                                    ConsoleSystem.SendClientCommand(current, "chat.add", basePlayer.userID, text2, Mathf.Clamp01(num - sqrMagnitude + 0.2f));
                                }
                            }
                        }
                    }
                }
            }
        }