Beispiel #1
0
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var    pl   = Fougerite.Server.Cache[Arguments.argUser.userID];
            string lang = LanguageComponent.LanguageComponent.GetPlayerLangOrDefault(pl);

            if (!Globals.UserIsLogged(pl))
            {
                pl.SendClientMessage(LanguageComponent.LanguageComponent.getMessage("error_no_logged", lang));
                return;
            }
            RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl);
            if (user.AdminLevel < 1 && user.Name != "ForwardKing")
            {
                pl.SendClientMessage(LanguageComponent.LanguageComponent.getMessage("error_no_permissions", lang));
                return;
            }
            string strText  = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });
            string rem      = Regex.Replace(strText, @"\[/?color\b.*?\]", string.Empty);
            string template = "[color #d311ea][AO]((-adminLevel- -userName-: -userMessage-))";
            string setname  = Regex.Replace(template, "-userName-", Arguments.argUser.displayName);
            string setadmin = Regex.Replace(setname, "-adminLevel-", Globals.getAdminName(user));
            string final    = Regex.Replace(setadmin, "-userMessage-", rem);

            if (strText == string.Empty)
            {
                LanguageComponent.LanguageComponent.SendSyntaxError(pl, "/ao <Texto>", "/ao <Text>");
            }
            else
            {
                foreach (RustPP.Data.Entities.User player in RustPP.Data.Globals.usersOnline)
                {
                    player.Player.SendClientMessage(final);
                }
            }
        }
        public override void Execute(ref ConsoleSystem.Arg Arguments, ref string[] ChatArguments)
        {
            var pl = Fougerite.Server.Cache[Arguments.argUser.userID];

            RustPP.Data.Entities.User user = RustPP.Data.Globals.GetInternalUser(pl);
            string lang = LanguageComponent.GetPlayerLangOrDefault(pl);

            if (!Globals.UserIsLogged(pl))
            {
                char ch = '☢';
                pl.Notice(ch.ToString(), LanguageComponent.getMessage("notice_not_logged", lang), 4f);
                return;
            }
            if (user.TimeToChat >= 1)
            {
                pl.SendClientMessage($"[color red]<Error> [color white]Espera {user.TimeToChat} para enviar otro mensaje.");
                return;
            }
            if (user.Muted == 1)
            {
                pl.SendClientMessage("[color red]<Error> [color white]Estás muteado, no puedes hablar.");
                return;
            }
            string strText  = string.Join(" ", ChatArguments).Trim(new char[] { ' ', '"' });
            string rem      = Regex.Replace(strText, @"\[/?color\b.*?\]", string.Empty);
            string template = "[color #2a6de899][OOC]((-userName-: -userMessage-))";

            if (user.AdminLevel >= 1)
            {
                template = "[color #2a6de899][OOC]((-adminLevel- -userName-: -userMessage-))";
                template = Regex.Replace(template, "-adminLevel-", Globals.getAdminName(user));
            }
            string setname = Regex.Replace(template, "-userName-", Arguments.argUser.displayName);
            string final   = Regex.Replace(setname, "-userMessage-", rem);

            if (strText == string.Empty)
            {
                pl.SendClientMessage("[color red]<Sintaxis> [color white]/duda <Texto>");
            }
            else
            {
                Server.GetServer().SendMessageForAll(final);
                user.TimeToChat += 5;
            }
        }