Ejemplo n.º 1
0
        void G_Say(gentity_t ent, gentity_t target, SayMode mode, string chatText)
        {
            string name = null;
            string color = "";

            switch (mode)
            {
                default:
                case SayMode.ALL:
                    LogPrintf("say: {0}: {1}\n", ent.client.pers.netname, chatText);
                    name = string.Format("{0}{1}{2}: ", ent.client.pers.netname, "^7", (char)0x19);
                    color = "2";
                    break;
                case SayMode.TEAM:
                    LogPrintf("sayteam: {0}: {1}\n", ent.client.pers.netname, chatText);
                    name = string.Format("{0}({1}{2}{3}){4}: ", (char)0x19, ent.client.pers.netname, "^7", (char)0x19, (char)0x19);
                    color = "5";
                    break;
                case SayMode.TELL:
                    name = string.Format("{0}[{1}{2}{2}]{2}", (char)0x19, ent.client.pers.netname, "^7",(char)0x19,(char)0x19);
                    color = "6";
                    break;
            }

            if (target != null)
            {
                G_SayTo(ent, target, mode, color, name, chatText);
                return;
            }

            // send it to all the apropriate clients
            gentity_t other;
            for (int i = 0; i < level.maxclients; i++)
            {
                other = g_entities[i];
                G_SayTo(ent, other, mode, color, name, chatText);
            }
        }
Ejemplo n.º 2
0
        void G_SayTo(gentity_t ent, gentity_t other, SayMode mode, string color, string name, string message)
        {
            if (other == null || !other.inuse || other.client == null || other.client.pers.connected != clientConnected_t.CON_CONNECTED || (mode == SayMode.TEAM && !OnSameTeam(ent, other)))
                return;

            Server.Instance.SendServerCommand(Server.Instance.clients[other.client.clientIndex], string.Format("{0} \"{1}{2}{3}\"", (mode == SayMode.TEAM) ? "tchat" : "chat", name, "^" + color, message));
        }
Ejemplo n.º 3
0
        void Cmd_Say_f(gentity_t ent, SayMode mode, string[] tokens, bool arg0)
        {
            if (tokens.Length < 2 && !arg0)
                return;

            string p;
            if (arg0)
                p = CubeHags.client.common.Commands.ArgsFrom(tokens, 0);
            else
                p = CubeHags.client.common.Commands.ArgsFrom(tokens, 1);

            G_Say(ent, null, mode, p);
        }