Exemplo n.º 1
0
        /**
         * Cmd_Drop_f
         *
         * Drop an inventory item.
         */
        public static void Drop_f(edict_t ent)
        {
            int     index;
            gitem_t it;
            string  s;

            s  = Cmd.Args();
            it = GameItems.FindItem(s);

            if (it == null)
            {
                SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\n");

                return;
            }

            if (it.drop == null)
            {
                SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, "Item is not dropable.\n");

                return;
            }

            index = GameItems.ITEM_INDEX(it);

            if (0 == ent.client.pers.inventory[index])
            {
                SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\n");

                return;
            }

            it.drop.drop(ent, it);
        }
Exemplo n.º 2
0
        public static void PlayerList_f(edict_t ent)
        {
            Int32   i;
            String  st;
            String  text;
            edict_t e2;

            text = "";
            for (i = 0; i < GameBase.maxclients.value; i++)
            {
                e2 = GameBase.g_edicts[1 + i];
                if (!e2.inuse)
                {
                    continue;
                }
                st = "" + (GameBase.level.framenum - e2.client.resp.enterframe) / 600 + ":" + ((GameBase.level.framenum - e2.client.resp.enterframe) % 600) / 10 + " " + e2.client.ping + " " + e2.client.resp.score + " " + e2.client.pers.netname + " " + (e2.client.resp.spectator ? " (spectator)" : "") + "\\n";
                if (text.Length + st.Length > 1024 - 50)
                {
                    text += "And more...\\n";
                    SV_GAME.PF_cprintfhigh(ent, "" + text + "");
                    return;
                }

                text += st;
            }

            SV_GAME.PF_cprintfhigh(ent, text);
        }
Exemplo n.º 3
0
        public static void Players_f(edict_t ent)
        {
            Int32  i;
            Int32  count;
            String small;
            String large;

            Int32[] index = new Int32[256];
            count = 0;
            for (i = 0; i < GameBase.maxclients.value; i++)
            {
                if (GameBase.game.clients[i].pers.connected)
                {
                    index[count] = i;
                    count++;
                }
            }

            index = index.OrderBy(p => p, Cmd.PlayerSort).ToArray();

            large = "";
            for (i = 0; i < count; i++)
            {
                small = GameBase.game.clients[index[i]].ps.stats[Defines.STAT_FRAGS] + " " + GameBase.game.clients[index[i]].pers.netname + "\\n";
                if (small.Length + large.Length > 1024 - 100)
                {
                    large += "...\\n";
                    break;
                }

                large += small;
            }

            SV_GAME.PF_cprintfhigh(ent, large + "\\n" + count + " players\\n");
        }
Exemplo n.º 4
0
        public static void Use_f(edict_t ent)
        {
            Int32   index;
            gitem_t it;
            String  s;

            s  = Cmd.Args();
            it = GameItems.FindItem(s);
            Com.Dprintln("using:" + s);
            if (it == null)
            {
                SV_GAME.PF_cprintfhigh(ent, "unknown item: " + s + "\\n");
                return;
            }

            if (it.use == null)
            {
                SV_GAME.PF_cprintfhigh(ent, "Item is not usable.\\n");
                return;
            }

            index = GameItems.ITEM_INDEX(it);
            if (0 == ent.client.pers.inventory[index])
            {
                SV_GAME.PF_cprintfhigh(ent, "Out of item: " + s + "\\n");
                return;
            }

            it.use.Use(ent, it);
        }
Exemplo n.º 5
0
        /**
         * Cmd_Wave_f
         */
        public static void Wave_f(edict_t ent)
        {
            int i;

            i = Lib.atoi(Cmd.Argv(1));

            // can't wave when ducked
            if ((ent.client.ps.pmove.pm_flags & pmove_t.PMF_DUCKED) != 0)
            {
                return;
            }

            if (ent.client.anim_priority > Defines.ANIM_WAVE)
            {
                return;
            }

            ent.client.anim_priority = Defines.ANIM_WAVE;

            switch (i)
            {
            case 0:
                SV_GAME.PF_cprintfhigh(ent, "flipoff\n");
                ent.s.frame         = M_Player.FRAME_flip01 - 1;
                ent.client.anim_end = M_Player.FRAME_flip12;

                break;

            case 1:
                SV_GAME.PF_cprintfhigh(ent, "salute\n");
                ent.s.frame         = M_Player.FRAME_salute01 - 1;
                ent.client.anim_end = M_Player.FRAME_salute11;

                break;

            case 2:
                SV_GAME.PF_cprintfhigh(ent, "taunt\n");
                ent.s.frame         = M_Player.FRAME_taunt01 - 1;
                ent.client.anim_end = M_Player.FRAME_taunt17;

                break;

            case 3:
                SV_GAME.PF_cprintfhigh(ent, "wave\n");
                ent.s.frame         = M_Player.FRAME_wave01 - 1;
                ent.client.anim_end = M_Player.FRAME_wave11;

                break;

            case 4:
            default:
                SV_GAME.PF_cprintfhigh(ent, "point\n");
                ent.s.frame         = M_Player.FRAME_point01 - 1;
                ent.client.anim_end = M_Player.FRAME_point12;

                break;
            }
        }
Exemplo n.º 6
0
        /**
         * Cmd_Players_f
         */
        public static void Players_f(edict_t ent)
        {
            int    i;
            int    count;
            string small;
            string large;

            var index = new int[256];

            count = 0;

            for (i = 0; i < GameBase.maxclients.value; i++)
            {
                if (GameBase.game.clients[i].pers.connected)
                {
                    index[count] = i;
                    count++;
                }
            }

            // sort by frags
            Array.Sort(index, 0, count - 1, Cmd.PlayerSort);

            // print information
            large = "";

            for (i = 0; i < count; i++)
            {
                small = GameBase.game.clients[index[i]].ps.stats[Defines.STAT_FRAGS] + " " + GameBase.game.clients[index[i]].pers.netname + "\n";

                if (small.Length + large.Length > 1024 - 100)
                {
                    // can't print all of them in one packet
                    large += "...\n";

                    break;
                }

                large += small;
            }

            SV_GAME.PF_cprintfhigh(ent, large + "\n" + count + " players\n");
        }
Exemplo n.º 7
0
        public static void InvDrop_f(edict_t ent)
        {
            gitem_t it;

            Cmd.ValidateSelectedItem(ent);
            if (ent.client.pers.selected_item == -1)
            {
                SV_GAME.PF_cprintfhigh(ent, "No item to drop.\\n");
                return;
            }

            it = GameItemList.itemlist[ent.client.pers.selected_item];
            if (it.drop == null)
            {
                SV_GAME.PF_cprintfhigh(ent, "Item is not dropable.\\n");
                return;
            }

            it.drop.Drop(ent, it);
        }
Exemplo n.º 8
0
        public static void God_f(edict_t ent)
        {
            String msg;

            if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0)
            {
                SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n");
                return;
            }

            ent.flags ^= Defines.FL_GODMODE;
            if (0 == (ent.flags & Defines.FL_GODMODE))
            {
                msg = "godmode OFF\\n";
            }
            else
            {
                msg = "godmode ON\\n";
            }
            SV_GAME.PF_cprintf(ent, Defines.PRINT_HIGH, msg);
        }
Exemplo n.º 9
0
        public static void Notarget_f(edict_t ent)
        {
            String msg;

            if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0)
            {
                SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n");
                return;
            }

            ent.flags ^= Defines.FL_NOTARGET;
            if (0 == (ent.flags & Defines.FL_NOTARGET))
            {
                msg = "notarget OFF\\n";
            }
            else
            {
                msg = "notarget ON\\n";
            }
            SV_GAME.PF_cprintfhigh(ent, msg);
        }
Exemplo n.º 10
0
        public static void Noclip_f(edict_t ent)
        {
            String msg;

            if (GameBase.deathmatch.value != 0 && GameBase.sv_cheats.value == 0)
            {
                SV_GAME.PF_cprintfhigh(ent, "You must run the server with '+set cheats 1' to enable this command.\\n");
                return;
            }

            if (ent.movetype == Defines.MOVETYPE_NOCLIP)
            {
                ent.movetype = Defines.MOVETYPE_WALK;
                msg          = "noclip OFF\\n";
            }
            else
            {
                ent.movetype = Defines.MOVETYPE_NOCLIP;
                msg          = "noclip ON\\n";
            }

            SV_GAME.PF_cprintfhigh(ent, msg);
        }
Exemplo n.º 11
0
 public void unicast(edict_t ent, bool reliable)
 {
     SV_GAME.PF_Unicast(ent, reliable);
 }
Exemplo n.º 12
0
 public bool inPHS(float[] p1, float[] p2)
 {
     return(SV_GAME.PF_inPHS(p1, p2));
 }
Exemplo n.º 13
0
 public void error(int level, string err)
 {
     SV_GAME.PF_error(level, err);
 }
Exemplo n.º 14
0
 public void sound(edict_t ent, int channel, int soundindex, float volume, float attenuation, float timeofs)
 {
     SV_GAME.PF_StartSound(ent, channel, soundindex, volume, attenuation, timeofs);
 }
Exemplo n.º 15
0
 public void cprintf(edict_t ent, int printlevel, string s)
 {
     SV_GAME.PF_cprintf(ent, printlevel, s);
 }
Exemplo n.º 16
0
 // some fractional bits
 public void WriteDir(float[] pos)
 {
     SV_GAME.PF_WriteDir(pos);
 }
Exemplo n.º 17
0
 public void WriteString(string s)
 {
     SV_GAME.PF_WriteString(s);
 }
Exemplo n.º 18
0
 public void WriteByte(int c)
 {
     SV_GAME.PF_WriteByte(c);
 }
Exemplo n.º 19
0
 public void WriteShort(int c)
 {
     SV_GAME.PF_WriteShort(c);
 }
Exemplo n.º 20
0
 public virtual void Dprintf(string s)
 {
     SV_GAME.PF_dprintf(s);
 }
Exemplo n.º 21
0
 public void WritePosition(float[] pos)
 {
     SV_GAME.PF_WritePos(pos);
 }
Exemplo n.º 22
0
 public virtual void Centerprintf(edict_t ent, string s)
 {
     SV_GAME.PF_centerprintf(ent, s);
 }
Exemplo n.º 23
0
 public void dprintf(string s)
 {
     SV_GAME.PF_dprintf(s);
 }
Exemplo n.º 24
0
 public virtual void Configstring(int num, string string_renamed)
 {
     SV_GAME.PF_Configstring(num, string_renamed);
 }
Exemplo n.º 25
0
 public void centerprintf(edict_t ent, string s)
 {
     SV_GAME.PF_centerprintf(ent, s);
 }
Exemplo n.º 26
0
 public virtual void Error(int level, string err)
 {
     SV_GAME.PF_error(level, err);
 }
Exemplo n.º 27
0
 // config strings hold all the index strings, the lightstyles,
 // and misc data like the sky definition and cdtrack.
 // All of the current configstrings are sent to clients when
 // they connect, and changes are sent to all connected clients.
 public void configstring(int num, string @string)
 {
     SV_GAME.PF_Configstring(num, @string);
 }
Exemplo n.º 28
0
 public virtual void Setmodel(edict_t ent, string name)
 {
     SV_GAME.PF_setmodel(ent, name);
 }
Exemplo n.º 29
0
 public void setmodel(edict_t ent, string name)
 {
     SV_GAME.PF_setmodel(ent, name);
 }
Exemplo n.º 30
0
 public virtual bool InPHS(float[] p1, float[] p2)
 {
     return(SV_GAME.PF_inPHS(p1, p2));
 }