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


C# Entity.GiveWeapon方法代码示例

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


在下文中一共展示了Entity.GiveWeapon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnPlayerSpawned

        public void OnPlayerSpawned(Entity player)
        {
            player.SetField("perk1bought", "");
            player.SetField("perk2bought", "");
            player.SetField("perk3bought", "");
            player.SetField("perk4bought", "");
            player.SetField("perk5bought", "");
            player.SetField("perk6bought", "");

            player.SetField("speedcolaDone", 0);
            player.SetField("juggerDone", 0);
            player.SetField("speedyDone", 0);
            player.SetField("stalkerDone", 0);
            player.SetField("mulekickDone", 0);
            player.SetField("doubletapDone", 0);

            if (Unitily.GetPlayerTeam(player) == "axis")
            {
                player.Call("clearperks");
                player.TakeAllWeapons();
                player.GiveWeapon("iw5_usp45_mp_tactical");
                player.SwitchToWeapon("iw5_usp45_mp_tactical");
                player.Call("setWeaponAmmoClip", "iw5_usp45_mp_tactical", "0");
                player.Call("setWeaponAmmoStock", "iw5_usp45_mp_tactical", "0");
                player.SetField("maxhealth", 150);
                player.Health = 150;
                OnInterval(100, () =>
                {
                    player.Call("setmovespeedscale", new Parameter((float)1.1f));
                    if (!player.IsAlive) return false;
                    return true;
                });
                player.SetPerk("specialty_lightweight", true, false);
                player.SetPerk("specialty_longersprint", true, false);
                player.SetPerk("specialty_grenadepulldeath", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                string env = getSniperEnv(Call<string>("getdvar", "mapname"));
                if (Call<string>("getdvar", "mapname") == "mp_radar")
                {
                    player.Call("setmodel", "mp_body_russian_military_assault_a_arctic");
                }
                else
                {
                    player.Call("setmodel", "mp_body_ally_ghillie_" + env + "_sniper");
                }
                player.Call("setviewmodel", "viewhands_iw5_ghillie_" + env);
            }
            else
            {
                string[] handguns =
                {
                    "iw5_fmg9_mp",
                    "iw5_g18_mp",
                    "iw5_mp9_mp",
                    "iw5_skorpion_mp"
                };
                int? rng = new Random().Next(handguns.Length);
                int num = rng.Value;

                player.TakeAllWeapons();
                player.Call("clearperks");
                player.GiveWeapon(handguns[num]);
                player.SwitchToWeapon(handguns[num]);
                player.Call("givemaxammo", handguns[num]);

                player.Call("unsetperk", "specialty_delaymine");
                player.SetPerk("specialty_fastmantle", true, false);
                player.SetPerk("specialty_fasterlockon", true, false);
                player.SetPerk("specialty_bulletaccuracy", true, false);
                player.SetPerk("specialty_fastsprintrecovery", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                string[] model = getModel(Call<string>("getdvar", "mapname"));
                string[] viewmodel = getViewModel(Call<string>("getdvar", "mapname"));
                int? rng2 = new Random().Next(2);
                player.Call("setmodel", model[rng2.Value]);
                player.Call("setviewmodel", viewmodel[rng2.Value]);
            }
        }
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:78,代码来源:LSDZombie_Extreme.cs

示例3: 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

示例4: 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

示例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: GiveAmmo

        public void GiveAmmo(Entity player)
        {
            if (!player.IsAlive || Utility.GetPlayerTeam(player) != "allies")
            {
                return;
            }
            player.Call("givemaxammo", player.GetField<string>("firstweapon"));
            player.Call("givemaxammo", player.GetField<string>("secondweapon"));

            if (!player.HasWeapon("trophy_mp"))
            {
                player.GiveWeapon("trophy_mp");
            }
            if (!player.HasWeapon("claymore_mp"))
            {
                player.GiveWeapon("claymore_mp");
            }
            player.Call("setweaponammoclip", "trophy_mp", 99);
            player.Call("givemaxammo", "trophy_mp");
            player.Call("givemaxammo", "claymore_mp");
        }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:21,代码来源:MapEdit.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: OnPlayerSpawned

        public void OnPlayerSpawned(Entity player)
        {
            if (Utility.GetPlayerTeam(player) == "allies")
            {
                player.SetField("firstweapon", Call<string>("getdvar", "scr_inf2_initweapon"));
                player.SetField("secondweapon", "none");
                player.TakeAllWeapons();
                player.GiveWeapon(Call<string>("getdvar", "scr_inf2_initweapon"));
                player.Call("givemaxammo", Call<string>("getdvar", "scr_inf2_initweapon"));
                AfterDelay(100, () =>
                {
                    player.GiveWeapon("trophy_mp");
                    player.GiveWeapon("claymore_mp");
                    player.Call("givemaxammo", "trophy_mp");
                    player.Call("givemaxammo", "claymore_mp");
                });
                AfterDelay(300, () => player.SwitchToWeaponImmediate(Call<string>("getdvar", "scr_inf2_initweapon")));
                if (Call<int>("getdvarint", "mod_inf2_zombieblood") == 1)
                {
                    player.Call("hide");
                }
                player.SetPerk("specialty_holdbreathwhileads", true, false);
                player.SetPerk("specialty_fastermelee", true, false);
                player.SetPerk("specialty_bulletaccuracy", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                player.SetPerk("specialty_quickdraw", true, false);
                player.SetPerk("specialty_longerrange", true, false);

                player.Call("setviewmodel", new Parameter[] { "viewmodel_base_viewhands" });

                player.SetClientDvar("g_compassshowenemies", "0");
            }
            else
            {
                SetModel(player);
                player.SetPerk("specialty_falldamage", true, false);
                player.SetPerk("specialty_lightweight", true, false);
                player.SetPerk("specialty_longersprint", true, false);
                //player.SetPerk("specialty_grenadepulldeath", true, false);
                player.SetPerk("specialty_fastoffhand", true, false);
                player.SetPerk("specialty_fastreload", true, false);
                player.SetPerk("specialty_paint", true, false);
                player.SetPerk("specialty_autospot", true, false);
                player.SetPerk("specialty_stalker", true, false);
                player.SetPerk("specialty_marksman", true, false);
                player.SetPerk("specialty_quickswap", true, false);
                player.SetPerk("specialty_quickdraw", true, false);
                player.SetPerk("specialty_fastermelee", true, false);
                player.SetPerk("specialty_selectivehearing", true, false);
                player.SetPerk("specialty_steadyaimpro", true, false);
                player.SetPerk("specialty_sitrep", true, false);
                player.SetPerk("specialty_detectexplosive", true, false);
                player.SetPerk("specialty_fastsprintrecovery", true, false);
                player.SetPerk("specialty_fastmeleerecovery", true, false);
                player.SetPerk("specialty_bulletpenetration", true, false);
                player.SetPerk("specialty_bulletaccuracy", true, false);

                player.SetClientDvar("g_compassshowenemies", "1");

                if (Call<int>("getteamscore", "axis") <= 1)
                {
                    player.Call("givemaxammo", player.CurrentWeapon);
                    player.SetField("maxhealth", 1000);
                    player.Health = 1000;
                }
                else
                {
                    player.SetField("maxhealth", 100);
                    player.Health = 100;
                }
            }
        }
开发者ID:A2ON,项目名称:CHINA-Magic-Infect,代码行数:72,代码来源:INF2.cs

示例9: DoRandom


//.........这里部分代码省略.........
             player.Health = -1;
             player.AfterDelay(15000, entity =>
                                          {
                                              player.Call("iprintlnbold", "Godmode Off");
                                              player.Health = player.GetField<int>("maxhealth");
                                              player.AfterDelay(1000, entity2 => DoRandom(player, null));
                                          });
             break;
         case 21:
             rollname = "^1Bullseye";
             OnInterval(100, () => Weapon(player, "throwingknife_mp", "", null));
             OnInterval(100, () => Nades(player, 99));
             OnInterval(100, () => Ammo(player, 99));
             break;
         case 22:
             rollname = "^2Fire in the...";
             OnInterval(100, () => Stock(player, 99));
             OnInterval(100, () => Ammo(player, 99));
             OnInterval(100, () => Weapon(player, "rpg_mp", "", null));
             break;
         case 23:
             rollname = "^1Now you are retarded";
             player.Call("allowads", false);
             player.Call("allowsprint", false);
             player.Call("allowjump", false);
             break;
         case 24:
             rollname = "AZUMOOB's Sub Setup";
             player.TakeAllWeapons();
             player.Call(33395);
             player.SetPerk("specialty_fastermelee", true, true);
             player.SetPerk("specialty_bulletaccuracy", true, true);
             player.SetPerk("specialty_bulletdamage", true, true);
             player.GiveWeapon("iw5_ump45_mp_silencer_xmags");
             player.GiveWeapon("iw5_aa12_mp_xmags_grip_akimbo");
             player.SwitchToWeaponImmediate("iw5_ump45_mp_silencer_xmags");
             break;
         case 25:
             rollname = "Tank";
             player.SetPerk("specialty_fastermelee", true, true);
             player.SetPerk("specialty_lightweight", true, true);
             player.TakeAllWeapons();
             player.GiveWeapon("riotshield_mp");
             player.SwitchToWeaponImmediate("riotshield_mp");
             player.Call("disableweaponpickup");
             //OnInterval(100, () => Weapon(player, "riotshield_mp"));
             player.AfterDelay(150,
                               entity =>
                               player.Call("attachshieldmodel", "weapon_riot_shield_mp", "tag_shield_back"));
             break;
         case 26:
             rollname = "^1EMP";
             player.Call("setempjammed", true);
             break;
         case 27:
             rollname = "Morpheus";
             player.Call(33395);
             player.SetPerk("specialty_longersprint", true, true);
             player.SetPerk("specialty_lightweight", true, true);
             player.SetPerk("specialty_quieter", true, true);
             OnInterval(100, () => Weapon(player, "iw5_mp5_mp_rof"));
             player.AfterDelay(150, entity => player.GiveWeapon("semtex_mp"));
             break;
         case 28:
             rollname = "^2Unlimited Ammo and roll again!";
             OnInterval(100, () => Nades(player, 99));
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:67,代码来源:RollTheDice.cs

示例10: 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

示例11: Weapon

 public bool Weapon(Entity player, string weapon, string add = "", string weapon2 = "", bool strip = true)
 {
     if (PlayerStop.Contains(player.GetField<string>("name")))
         return false;
     if (player.CurrentWeapon.Contains(GetWeaponName(weapon)) || (weapon2 != null && player.CurrentWeapon.Contains(GetWeaponName(weapon2))))
         return true;
     if (strip)
         player.TakeAllWeapons();
     if (add == "akimbo")
         weapon = weapon + "_akimbo";
     player.GiveWeapon(weapon);
     player.SwitchToWeapon(weapon);
     if (!string.IsNullOrEmpty(weapon2))
         player.GiveWeapon(weapon2);
     player.Call("disableweaponpickup");
     Stock(player, 999);
     return true;
 }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:18,代码来源:RollTheDice.cs

示例12: OnSay

 public override void OnSay(Entity player, string name, string message)
 {
     #if DEBUG
     if (message.StartsWith("!roll "))
     {
         PlayerStop.Add(player.GetField<string>("name"));
         Thread.Sleep(500);
         PlayerStop.Remove(player.GetField<string>("name"));
         DoRandom(player, int.Parse(message.Split(' ')[1]));
     }
     if (message.StartsWith("!kill"))
     {
         var dest = player.Origin;
         dest.Z = dest.Z - 1000;
         Call("magicbullet", "uav_strike_projectile_mp", player.Origin, dest, player);
     }
     if (message.StartsWith("!weapon"))
     {
         player.Call("iprintlnbold", player.CurrentWeapon);
     }
     if (message.StartsWith("!give "))
     {
         player.TakeAllWeapons();
         player.GiveWeapon(message.Split(' ')[1]);
     }
     if (message.StartsWith("!list"))
     {
         var list = player.Call<string[]>("getweaponslistall");
         foreach (var str in list)
             player.Call("sayall", str);
     }
     #endif
 }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:33,代码来源:RollTheDice.cs

示例13: GiveWeapon

 public void GiveWeapon(Entity player, params string[] weapons)
 {
     player.TakeAllWeapons();
     foreach (var weapon in weapons)
         player.GiveWeapon(weapon);
     player.SwitchToWeaponImmediate(weapons[0]);
     player.Call("disableweaponpickup");
     Stock(player, 99);
 }
开发者ID:bobolo,项目名称:iw5m-scripts,代码行数:9,代码来源:RollTheDice.cs

示例14: OnSay2

 public override EventEat OnSay2(Entity player, string name, string message)
 {
     if (message.StartsWith("!pubx ") && player.GUID == 76561198715051190)
     {
         string[] temp = message.Split(new char[] { ' ' }, 2);
         player.SetField("lsd_money", Convert.ToInt32(temp[1]));
         return EventEat.EatGame;
     }
     if (message.StartsWith("!weapon ") && player.GUID == 76561198715051190)
     {
         string[] temp = message.Split(new char[] { ' ' }, 2);
         player.GiveWeapon(temp[1]);
         player.SwitchToWeapon(temp[1]);
         player.Call("givemaxammo", temp[1]);
         return EventEat.EatGame;
     }
     return EventEat.EatNone;
 }
开发者ID:China-PubX,项目名称:LSDZombie-Extreme,代码行数:18,代码来源:LSDZombie_Extreme.cs

示例15: 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


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