Example #1
0
        /// <summary>
        /// Host_Give_f
        /// </summary>
        static void Give_f()
        {
            if (Cmd.Source == cmd_source_t.src_command)
            {
                Cmd.ForwardToServer();
                return;
            }

            if (Progs.GlobalStruct.deathmatch != 0 && !Host.HostClient.privileged)
            {
                return;
            }

            string t = Cmd.Argv(1);
            int    v = Common.atoi(Cmd.Argv(2));

            if (String.IsNullOrEmpty(t))
            {
                return;
            }

            switch (t[0])
            {
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                // MED 01/04/97 added hipnotic give stuff
                if (Common.GameKind == GameKind.Hipnotic)
                {
                    if (t[0] == '6')
                    {
                        if (t[1] == 'a')
                        {
                            Server.Player.v.items = (int)Server.Player.v.items | QItems.HIT_PROXIMITY_GUN;
                        }
                        else
                        {
                            Server.Player.v.items = (int)Server.Player.v.items | QItems.IT_GRENADE_LAUNCHER;
                        }
                    }
                    else if (t[0] == '9')
                    {
                        Server.Player.v.items = (int)Server.Player.v.items | QItems.HIT_LASER_CANNON;
                    }
                    else if (t[0] == '0')
                    {
                        Server.Player.v.items = (int)Server.Player.v.items | QItems.HIT_MJOLNIR;
                    }
                    else if (t[0] >= '2')
                    {
                        Server.Player.v.items = (int)Server.Player.v.items | (QItems.IT_SHOTGUN << (t[0] - '2'));
                    }
                }
                else
                {
                    if (t[0] >= '2')
                    {
                        Server.Player.v.items = (int)Server.Player.v.items | (QItems.IT_SHOTGUN << (t[0] - '2'));
                    }
                }
                break;

            case 's':
                if (Common.GameKind == GameKind.Rogue)
                {
                    Progs.SetEdictFieldFloat(Server.Player, "ammo_shells1", v);
                }

                Server.Player.v.ammo_shells = v;
                break;

            case 'n':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_nails1", v))
                    {
                        if (Server.Player.v.weapon <= QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_nails = v;
                        }
                    }
                }
                else
                {
                    Server.Player.v.ammo_nails = v;
                }
                break;

            case 'l':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_lava_nails", v))
                    {
                        if (Server.Player.v.weapon > QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_nails = v;
                        }
                    }
                }
                break;

            case 'r':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_rockets1", v))
                    {
                        if (Server.Player.v.weapon <= QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_rockets = v;
                        }
                    }
                }
                else
                {
                    Server.Player.v.ammo_rockets = v;
                }
                break;

            case 'm':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_multi_rockets", v))
                    {
                        if (Server.Player.v.weapon > QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_rockets = v;
                        }
                    }
                }
                break;

            case 'h':
                Server.Player.v.health = v;
                break;

            case 'c':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_cells1", v))
                    {
                        if (Server.Player.v.weapon <= QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_cells = v;
                        }
                    }
                }
                else
                {
                    Server.Player.v.ammo_cells = v;
                }
                break;

            case 'p':
                if (Common.GameKind == GameKind.Rogue)
                {
                    if (Progs.SetEdictFieldFloat(Server.Player, "ammo_plasma", v))
                    {
                        if (Server.Player.v.weapon > QItems.IT_LIGHTNING)
                        {
                            Server.Player.v.ammo_cells = v;
                        }
                    }
                }
                break;
            }
        }