当前位置: 首页>>代码示例>>C#>>正文


C# Entity.TakeWeapon方法代码示例

本文整理汇总了C#中System.Entity.TakeWeapon方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.TakeWeapon方法的具体用法?C# Entity.TakeWeapon怎么用?C# Entity.TakeWeapon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Entity的用法示例。


在下文中一共展示了Entity.TakeWeapon方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GamblerThink

 public void GamblerThink(Entity player)
 {
     player.Call("iprintlnbold", ("^210"));
     player.Call("playlocalsound", "ui_mp_nukebomb_timer");
     AfterDelay(1000, () => player.Call("iprintlnbold", ("^29")));
     AfterDelay(1000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(2000, () => player.Call("iprintlnbold", ("^28")));
     AfterDelay(2000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(3000, () => player.Call("iprintlnbold", ("^27")));
     AfterDelay(3000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(4000, () => player.Call("iprintlnbold", ("^26")));
     AfterDelay(4000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(5000, () => player.Call("iprintlnbold", ("^25")));
     AfterDelay(5000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(6000, () => player.Call("iprintlnbold", ("^24")));
     AfterDelay(6000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(7000, () => player.Call("iprintlnbold", ("^23")));
     AfterDelay(7000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(8000, () => player.Call("iprintlnbold", ("^22")));
     AfterDelay(8000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(9000, () => player.Call("iprintlnbold", ("^21")));
     AfterDelay(9000, () => player.Call("playlocalsound", "ui_mp_nukebomb_timer"));
     AfterDelay(10000, () =>
     {
         int? rng = new Random().Next(14);
         switch (rng.Value)
         {
             case 0:
                 player.Call("iprintlnbold", ("^1You win nothing."));
                 player.Call("playlocalsound", "mp_bonus_end");
                 break;
             case 1:
                 player.Call("iprintlnbold", ("^2You win 500."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 player.SetField("lsd_money", player.GetField<int>("lsd_money") + 500);
                 break;
             case 2:
                 player.Call("iprintlnbold", ("^2You win 1000."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 player.SetField("lsd_money", player.GetField<int>("lsd_money") + 1000);
                 break;
             case 3:
                 player.Call("iprintlnbold", ("^2You win 2000."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 player.SetField("lsd_money", player.GetField<int>("lsd_money") + 2000);
                 break;
             case 4:
                 player.Call("iprintlnbold", ("^2You win a Ray Gun."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 if (getWeaponsNum(player) > 1)
                 {
                     player.TakeWeapon(player.CurrentWeapon);
                 }
                 player.GiveWeapon("iw5_m9_mp_eotechsmg_camo08");
                 player.Call("givemaxammo", "iw5_m9_mp_eotechsmg_camo08");
                 player.SwitchToWeapon("iw5_m9_mp_eotechsmg_camo08");
                 break;
             case 5:
                 player.Call("iprintlnbold", ("^1You lose 500."));
                 player.Call("playlocalsound", "mp_bonus_end");
                 player.SetField("lsd_money", player.GetField<int>("lsd_money") - 500);
                 break;
             case 6:
                 player.Call("iprintlnbold", ("^1You lose all money."));
                 player.Call("playlocalsound", "mp_bonus_end");
                 player.SetField("lsd_money", 0);
                 break;
             case 7:
                 player.Call("iprintlnbold", ("^2You win max ammo."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 GiveAmmo(player);
                 break;
             case 8:
                 player.Call("iprintlnbold", ("^1You lose all perks."));
                 player.Call("playlocalsound", "mp_bonus_end");
                 player.Call("clearperks");
                 player.SetField("speedcolaDone", 0);
                 player.SetField("juggerDone", 0);
                 player.SetField("speedyDone", 0);
                 player.SetField("stalkerDone", 0);
                 player.SetField("mulekickDone", 0);
                 player.SetField("doubletapDone", 0);
                 player.SetField("perk1bought", 0);
                 player.SetField("perk2bought", 0);
                 player.SetField("perk3bought", 0);
                 player.SetField("perk4bought", 0);
                 player.SetField("perk5bought", 0);
                 player.SetField("perk6bought", 0);
                 player.Notify("lsd_clearperks", player);
                 break;
             case 9:
                 player.Call("iprintlnbold", ("^2You win 10000."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 player.SetField("lsd_money", player.GetField<int>("lsd_money") + 10000);
                 break;
             case 10:
                 player.Call("iprintlnbold", ("^2You win a USAS."));
                 player.Call("playlocalsound", "mp_bonus_start");
                 if (getWeaponsNum(player) > 1)
                 {
//.........这里部分代码省略.........
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:101,代码来源:MapEdit.cs

示例2: usedRandomWeaponBox

        public void usedRandomWeaponBox(Entity box, Entity player)
        {
            if (!player.IsAlive) return;
            if (Unitily.GetPlayerTeam(player) == "axis") return;
            else
            {
                if (box.GetField<string>("state") == "using") return;
                if (box.GetField<string>("state") == "waiting" && box.GetField<string>("player") != player.GUID.ToString()) return;
                if (box.GetField<string>("state") == "waiting" && box.GetField<string>("player") == player.GUID.ToString())
                {
                    if (player.HasWeapon(box.GetField<string>("weapon")))
                    {
                        player.Call("givemaxammo", box.GetField<string>("weapon"));
                        player.SwitchToWeapon(box.GetField<string>("weapon"));
                    }
                    else
                    {
                        if (getWeaponsNum(player) > 1)
                        {
                            player.TakeWeapon(player.CurrentWeapon);
                        }
                        player.GiveWeapon(box.GetField<string>("weapon"));
                        player.Call("givemaxammo", box.GetField<string>("weapon"));
                        player.SwitchToWeapon(box.GetField<string>("weapon"));
                    }
                    weapon.Call("delete");
                    box.SetField("weapon", "");
                    box.SetField("player", "");
                    AfterDelay(2000, () => box.SetField("state", "idle"));
                    isDestroy = true;
                }
                else if (box.GetField<string>("state") == "idle")
                {
                    if (player.GetField<int>("lsd_money") >= 350)
                    {
                        weapon = Call<Entity>("spawn", "script_model", new Parameter(box.Origin));
                        weapon.SetField("angles", box.GetField<Vector3>("angles"));
                        player.SetField("lsd_money", player.GetField<int>("lsd_money") - 350);
                        int? rng = new Random().Next(weaponlist.Length);
                        Vector3 temp = box.Origin;
                        temp.Z = temp.Z + 40;
                        weapon.Call("moveto", temp, 3);
                        box.SetField("player", player.GUID.ToString());
                        box.SetField("state", "using");
                        for (int i = 0; i < 3000; i += 100)
                        {
                            AfterDelay(0 + i, () =>
                            {
                                rng = new Random().Next(weaponlist.Length);
                                int r = rng.Value;
                                string _weapon = weaponlist[r];
                                if (_weapon.StartsWith("iw5_acr"))
                                {
                                    weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 13)));
                                }
                                else
                                {
                                    weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 0)));
                                }
                            });
                        }
                        for (int i = 0; i < 1000; i += 300)
                        {
                            AfterDelay(3000 + i, () =>
                            {
                                rng = new Random().Next(weaponlist.Length);
                                int r = rng.Value;
                                string _weapon = weaponlist[r];
                                if (_weapon.StartsWith("iw5_acr"))
                                {
                                    weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 13)));
                                }
                                else
                                {
                                    weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 0)));
                                }
                            });
                        }

                        AfterDelay(4000, () =>
                        {
                            int r = rng.Value;
                            string _weapon = weaponlist[r];
                            if (_weapon.StartsWith("iw5_acr") || _weapon.StartsWith("iw5_scar"))
                            {
                                weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 13)));
                            }
                            else
                            {
                                weapon.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 0)));
                            }
                            temp.Z = temp.Z - 40;
                            weapon.Call("moveto", temp, 8);
                            box.SetField("state", "waiting");
                            box.SetField("weapon", _weapon);
                        });
                        AfterDelay(12000, () =>
                        {
                            if (box.GetField<string>("state") == "waiting" && isDestroy == false)
                            {
//.........这里部分代码省略.........
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:101,代码来源:MapEdit.cs

示例3: usedUpgrade

 public void usedUpgrade(Entity box, Entity player)
 {
     if (!player.IsAlive) return;
     if (Unitily.GetPlayerTeam(player) == "axis") return;
     else
     {
         if (box.GetField<string>("state") == "using") return;
         if (box.GetField<string>("state") == "waiting" && box.GetField<string>("player") != player.GUID.ToString()) return;
         if (box.GetField<string>("state") == "waiting" && box.GetField<string>("player") == player.GUID.ToString())
         {
             player.GiveWeapon(box.GetField<string>("weapon"));
             player.Call("givemaxammo", box.GetField<string>("weapon"));
             player.SwitchToWeapon(box.GetField<string>("weapon"));
             weapon2.Call("delete");
             box.SetField("weapon", "");
             box.SetField("player", "");
             AfterDelay(2000, () => box.SetField("state", "idle"));
             this.isDestroy2 = true;
         }
         else if (box.GetField<string>("state") == "idle")
         {
             if (player.GetField<int>("lsd_money") >= 500)
             {
                 if (weaponlist.Contains(player.CurrentWeapon))
                 {
                     weapon2 = Call<Entity>("spawn", "script_model", new Parameter(box.Origin));
                     weapon2.SetField("angles", box.GetField<Vector3>("angles"));
                     player.SetField("lsd_usingboxnum", box.EntRef);
                     player.SetField("lsd_money", player.GetField<int>("lsd_money") - 500);
                     box.SetField("state", "using");
                     box.SetField("player", player.GUID.ToString());
                     weapon2.SetField("working", 1);
                     string _weapon = player.CurrentWeapon;
                     if (_weapon.StartsWith("iw5_acr") || _weapon.StartsWith("iw5_scar"))
                     {
                         weapon2.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 13)));
                     }
                     else
                     {
                         weapon2.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 0)));
                     }
                     Vector3 temp = player.Origin;
                     temp.Z = temp.Z + 50;
                     player.TakeWeapon(player.CurrentWeapon);
                     weapon2.Origin = temp;
                     weapon2.Call("moveto", box.Origin, 3);
                     AfterDelay(3000, () =>
                     {
                         for (int i = 0; i < weaponlist.Length; i++)
                         {
                             if (weaponlist[i] == _weapon)
                             {
                                 _weapon = upgradeweaponlist[i];
                                 break;
                             }
                         }
                         if (_weapon.StartsWith("iw5_acr") || _weapon.StartsWith("iw5_scar"))
                         {
                             weapon2.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 12)));
                         }
                         else if (_weapon.StartsWith("iw5_m9_mp_eotechsmg"))
                         {
                             weapon2.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 8)));
                         }
                         else if (_weapon.StartsWith("iw5_m60"))
                         {
                             weapon2.Call("setmodel", "weapon_steyr_blue_tiger");
                         }
                         else
                         {
                             weapon2.Call("setmodel", new Parameter(Call<string>("GetWeaponModel", _weapon, 9)));
                         }
                         temp = box.Origin;
                         temp.Z = temp.Z + 50;
                         weapon2.Call("moveto", temp, 3);
                     });
                     AfterDelay(6000, () =>
                     {
                         temp = box.Origin;
                         box.SetField("state", "waiting");
                         box.SetField("weapon", _weapon);
                         weapon2.Call("moveto", temp, 8);
                     });
                     AfterDelay(14000, () =>
                     {
                         if (box.GetField<string>("state") == "waiting" && this.isDestroy2 == false)
                         {
                             box.SetField("state", "idle");
                             box.SetField("weapon", "");
                             box.SetField("player", "");
                             weapon.Call("delete");
                         }
                         isDestroy2 = false;
                     });
                 }
                 else
                 {
                     player.Call("iprintlnbold", "^1You currect weapon can not upgrade.");
                 }
             }
//.........这里部分代码省略.........
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:101,代码来源:MapEdit.cs

示例4: GamblerThink


//.........这里部分代码省略.........
                            }
                        });
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 20:
                        PrintGambleInfo(player, "^2Insta Kill!");
                        player.Call("playsound", "mp_level_up");
                        player.SetField("gamblerstate", "idle");
                        if (Call<int>("getdvarint", "mod_inf2_instakill") == 1)
                        {
                            break;
                        }
                        Call("setdvar", "mod_inf2_instakill", 1);
                        AfterDelay(30000, () =>
                        {
                            Call("setdvar", "mod_inf2_instakill", 0);
                            foreach (var item in Utility.getPlayerList())
                            {
                                if (Utility.GetPlayerTeam(item) == "allies")
                                {
                                    item.Call("iprintlnbold", "Insta Kill off!");
                                }
                            }
                        });
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 21:
                        PrintGambleInfo(player, "^2Max Ammo!");
                        player.Call("playsound", "mp_level_up");
                        player.SetField("gamblerstate", "idle");
                        foreach (var item in Utility.getPlayerList())
                        {
                            if (!item.IsAlive || Utility.GetPlayerTeam(item) != "allies")
                            {
                                continue;
                            }
                            GiveAmmo(player);
                        }
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 22:
                        PrintGambleInfo(player, "KaBoom!");
                        player.Call("playsound", "nuke_explosion");
                        int delay = 1;
                        foreach (var item in Utility.getPlayerList())
                        {
                            if (Utility.GetPlayerTeam(item) == "axis" && item.IsAlive)
                            {
                                AfterDelay(delay * 1000, () =>
                                {
                                    Call("playfx", Call<int>("loadfx", "props/barrelexp"), item.Call<Vector3>("gettagorigin", "j_head"));
                                    item.Call("playsound", new Parameter[] { "explo_mine" });
                                    item.Call("suicide");
                                    player.SetField("inf2_money", player.GetField<int>("inf2_money") + 100);
                                });
                                delay++;
                            }
                        }
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 23:
                        PrintGambleInfo(player, "^2Juggernaut");
                        player.Call("playlocalsound", new Parameter[] { "mp_bonus_start" });
                        player.Call("setmodel", "mp_fullbody_ally_juggernaut");
                        player.Call("setviewmodel", "viewhands_juggernaut_ally");
                        player.SetField("maxhealth", 300);
                        player.Health = 300;
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 24:
                        PrintGambleInfo(player, "^2Fast Speed");
                        player.Call("playlocalsound", new Parameter[] { "mp_bonus_start" });
                        OnInterval(100, () =>
                        {
                            player.Call("setmovespeedscale", 1.5f);
                            return player.IsAlive;
                        });
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 25:
                        PrintGambleInfo(player, "^1You lose all weapon.");
                        player.Call("playlocalsound", new Parameter[] { "mp_bonus_end" });
                        player.TakeWeapon(player.GetField<string>("firstweapon"));
                        player.TakeWeapon(player.GetField<string>("secondweapon"));
                        player.SetField("gamblerstate", "idle");
                        break;
                    case 26:
                        PrintGambleInfo(player, "^1You Boooooom!");
                        player.Call("suicide");
                        AfterDelay(300, () =>
                        {
                            Call("RadiusDamage", new Parameter[] { player.Origin, 500, 500, 500, player, "MOD_EXPLOSIVE", "nuke_mp" });
                            Call("playfx", new Parameter[] { this.Call<int>("loadfx", new Parameter[] { "explosions/tanker_explosion" }), player.Origin });
                            player.Call("playsound", new Parameter[] { "cobra_helicopter_crash" });
                        });
                        player.SetField("gamblerstate", "idle");
                        break;
                }
            });
        }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:101,代码来源:MapEdit.cs

示例5: usedMysteryBox

 public void usedMysteryBox(Entity box, Entity player)
 {
     if (player.IsAlive && (Utility.GetPlayerTeam(player) != "axis"))
     {
         if (player.CurrentWeapon.Contains("killstreak") || player.CurrentWeapon.Contains("airdrop"))
         {
             return;
         }
         if (player.GetField<int>("inf2_money") < 500)
         {
             player.Call("iprintln", new Parameter[] { "^1Mystery box need $500." });
             return;
         }
         else
         {
             player.SetField("inf2_money", player.GetField<int>("inf2_money") - 500);
             Weapon weapon = Weapon.GetRandomWeapon();
             if (player.HasWeapon(weapon.Text))
             {
                 if (weapon.Text == "defaultweapon_mp")
                 {
                     player.Call("setweaponammoclip", weapon.Text, 0);
                     player.Call("setweaponammostock", weapon.Text, 0);
                 }
                 else
                 {
                     player.Call("givemaxammo", new Parameter[] { weapon.Text });
                 }
                 player.SwitchToWeapon(weapon.Text);
                 player.Call("iprintlnbold", weapon.Name);
                 Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
             }
             else
             {
                 if (player.GetField<string>("secondweapon") != "none")
                 {
                     if (player.GetField<string>("firstweapon") == player.CurrentWeapon)
                     {
                         player.SetField("firstweapon", weapon.Text);
                     }
                     else if (player.GetField<string>("secondweapon") == player.CurrentWeapon)
                     {
                         player.SetField("secondweapon", weapon.Text);
                     }
                     player.TakeWeapon(player.CurrentWeapon);
                 }
                 else
                 {
                     player.SetField("secondweapon", weapon.Text);
                 }
                 player.GiveWeapon(weapon.Text);
                 if (weapon.Text == "defaultweapon_mp")
                 {
                     player.Call("setweaponammoclip", weapon.Text, 0);
                     player.Call("setweaponammostock", weapon.Text, 0);
                 }
                 else
                 {
                     player.Call("givemaxammo", new Parameter[] { weapon.Text });
                 }
                 AfterDelay(300, () => player.SwitchToWeaponImmediate(weapon.Text));
                 player.Call("iprintlnbold", weapon.Name);
                 Call("iprintln", player.Name + " buy weapon - " + weapon.Name);
             }
         }
     }
 }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:67,代码来源:MapEdit.cs

示例6: usedBox

 public void usedBox(Entity box, Entity player)
 {
     if (player.GetField<string>("sessionteam") == "axis") return;
     if (box.GetField<string>("state").Equals("inuse") && box.GetField<Entity>("player").Equals(player))
     {
         player.TakeWeapon(player.CurrentWeapon);
         string name = Utilities.BuildWeaponName(weaponNames[box.GetField<int>("giveweapon")], "", "", 0, 0);
         player.GiveWeapon(name);
         player.SwitchToWeaponImmediate(name);
         box.GetField<Entity>("weaponent").Call("delete");
         box.SetField("_destroyed", true);
         box.SetField("state", "idle");
         return;
     }
     if (!box.GetField<string>("state").Equals("idle")) return;
     box.SetField("state", "inuse");
     Entity weapon = Call<Entity>("spawn", "script_model", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)));
     box.SetField("weaponent", new Parameter(weapon));
     weapon.Call("setmodel", weaponModels[0]);
     int timecount = 0;
     int weapnum = 0;
     OnInterval(50, () =>
     {
         weapnum = _rng.Next(weaponModels.Length);
         weapon.Call("setmodel", weaponModels[weapnum]);
         Vector3 origin = weapon.Origin;
         weapon.Call("moveto", new Parameter(new Vector3(origin.X, origin.Y, origin.Z + 0.37f)), .05f); // moveto
         timecount++;
         if (timecount == 60) return false;
         return true;
     });
     AfterDelay(3000, () =>
     {
         box.SetField("state", "waiting");
         box.SetField("giveweapon", weapnum);
         weapon.Call("moveto", new Parameter(new Vector3(box.Origin.X, box.Origin.Y, box.Origin.Z + 10)), 10); // moveto
         box.SetField("player", new Parameter(player));
     });
     AfterDelay(13000, () =>
     {
         if (box.GetField<string>("state") != "idle")
         {
             if (!box.GetField<bool>("_destroyed"))
             {
                 weapon.Call("delete");
                 box.SetField("state", "idle");
             }
             box.SetField("_destroyed", false);
         }
     });
 }
开发者ID:ahmad009,项目名称:MyShop,代码行数:51,代码来源:MyMapedit.cs

示例7: DoRandom

 public void DoRandom(Entity player)
 {
     int? roll = new Random().Next(NumOfRolls);
     var rollname = "";
     switch (roll)
     {
         case 0:
             rollname = "None";
             break;
         case 1:
             rollname = "^2One Ammo XM25";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("xm25_mp");
             player.Call("setweaponammoclip", "xm25_mp", 1);
             player.Call("setweaponammostock", "xm25_mp", 0);
             AfterDelay(300, () => player.SwitchToWeaponImmediate("xm25_mp"));
             break;
         case 2:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 3:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 4:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 5:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 6:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 7:
             rollname = "^2SMAW";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("iw5_smaw_mp");
             AfterDelay(300, () => player.SwitchToWeaponImmediate("iw5_smaw_mp"));
             break;
         case 8:
             rollname = "^1Stinger";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("stinger_mp");
             AfterDelay(300, () => player.SwitchToWeaponImmediate("stinger_mp"));
             break;
         case 9:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 10:
             rollname = "^2Extra Speed";
             OnInterval(100, () => Speed(player, 1.5));
             break;
         case 11:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 12:
             rollname = "^2AA12";
             player.TakeWeapon(player.CurrentWeapon);
             player.GiveWeapon("iw5_aa12_mp_xmags_camo11");
             player.Call("setweaponammostock", "iw5_aa12_mp_xmags_camo11", 0);
             AfterDelay(300, () => player.SwitchToWeaponImmediate("iw5_aa12_mp_xmags_camo11"));
             break;
         case 13:
             rollname = "^2Juggernaut";
             player.SetField("maxhealth", player.Health * 3);
             player.Health = player.Health * 3;
             player.Call("setmodel", "mp_fullbody_opforce_juggernaut");
             player.Call("setviewmodel", "viewhands_juggernaut_opforce");
             break;
         case 14:
             rollname = "^1You are a one hit kill";
             player.SetField("maxhealth", 1);
             player.Health = 1;
             break;
         case 15:
             rollname = "^1Turtle";
             OnInterval(100, () => Speed(player, 0.4f));
             break;
         case 16:
             rollname = "^1Turtle";
             OnInterval(100, () => Speed(player, 0.4f));
             break;
         case 17:
//.........这里部分代码省略.........
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:101,代码来源:ZombieRollTheDice.cs

示例8: upgradeWeapon

        public static string upgradeWeapon(Entity player)
        {
            string weapon = player.CurrentWeapon;
            string basenewweapon = "";
            string basename = WeaponUtils.weapon_getBasename(weapon);
            int camo = player.GetField<int>("camo");
            int reticle = player.GetField<int>("reticle");

            if (weapon.StartsWith("iw5_pp90m1"))
            {
                player.Call("iprintlnbold", "^3IS SMG");
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomAR(camo, reticle);
            }

            if (Array.IndexOf(WeaponUtils._smgList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                player.Call("iprintlnbold", "^3IS SMG");
                basenewweapon = WeaponUtils.getRandomAR(camo, reticle);
            }

            else if (Array.IndexOf(WeaponUtils._arList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomLMG(camo, reticle);
            }
            else if (Array.IndexOf(WeaponUtils._pistolList, basename) > 0)
            {
                player.TakeWeapon(weapon);
                basenewweapon = WeaponUtils.getRandomAutoPistol(camo, reticle);
            }
            else
            {
                return "You cannot upgrade this weapon!";
            }

            string[] newattach = WeaponUtils.weapon_getAttachments(weapon);
            string newweapon = WeaponUtils.weapon_getWeaponName(basenewweapon, newattach, player.GetField<int>("camo"), player.GetField<int>("reticle"));
            player.GiveWeapon(newweapon);

            player.AfterDelay(100, entity =>
            {
                player.SwitchToWeaponImmediate(newweapon);
                player.Call("iprintlnbold", "Upgraded Weapon!");
            });

            return "";
        }
开发者ID:ahmad009,项目名称:MyShop,代码行数:49,代码来源:WeaponUtils.cs


注:本文中的System.Entity.TakeWeapon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。