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


C# UnturnedPlayer.GiveItem方法代码示例

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


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

示例1: SpawnMagsWithLimit_Uconomy

        public void SpawnMagsWithLimit_Uconomy(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
        {
            int costMultiplier = EasyAmmo.Instance.Configuration.Instance.PerBulletCostMultiplier;
            SDG.Unturned.ItemMagazineAsset magazine = (SDG.Unturned.ItemMagazineAsset)UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command));

            if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
            {
                if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine))
                {
                    if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                    {
                        Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine));

                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id)));
                    }
                    else
                    {
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds",
                        Uconomy.Instance.Configuration.Instance.MoneyName,
                        ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString()));
                }
            }
            else
            {
                ushort amountoverlimit = ammoAmountToSpawn;
                ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;

                if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine))
                {
                    if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                    {
                        Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine));

                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_giving", amountoverlimit.ToString(),
                            EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name,
                            GetMagId(Uplayer, currentWeapon, command).ToString()));
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id)));
                    }
                    else
                    {
                        UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds",
                        Uconomy.Instance.Configuration.Instance.MoneyName,
                        ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString()));
                }
            }
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:57,代码来源:CommandAmmo.cs

示例2: SpawnMagsWithLimit

        public void SpawnMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
        {
            if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit"))
            {
                if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
                }
                else
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                }
            }
            else
            {
                ushort amountoverlimit = ammoAmountToSpawn;
                ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit;

                if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
                {
                    UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_giving", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
                }
                else
                {
                     UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
                }
            }
        }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:28,代码来源:CommandAmmo.cs

示例3: SpawnMags

 public void SpawnMags(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command)
 {
     if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn))
     {
         UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).Name, GetMagId(Uplayer, currentWeapon, command).ToString()));
     }
     else
     {
         UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags"));
     }
 }
开发者ID:RocketModPlugins,项目名称:EasyAmmo,代码行数:11,代码来源:CommandAmmo.cs

示例4: preparePlayer

        private void preparePlayer(UnturnedPlayer player)
        {
            //save player state
            states.Add(player.CSteamID, PlayerState.getState(DGPlugin.getPlayer(player.CSteamID)));
            credits.Add(player.CSteamID, Currency.getBalance(player));

            //add player to scores and deaths lists
            scores.Add(player.CSteamID, 0);
            deaths.Add(player.CSteamID, 0);

            //clear player inventory
            PlayerState.clearInventory(player);

            //heal up all survival stats
            PlayerState.clearStats(player);

            //give players vanish-mode and god-mode
            player.Features.VanishMode = true;
            player.Features.GodMode = true;

            //teleport player to arena location
            DGPlugin.teleportPlayerInRadius(player, currentLocation, radius);

            //give players starting item if present
            if (startItem != 0)
            {
                player.GiveItem(startItem, 1);
                player.Player.Equipment.equip(2, 1, 1);
            }
        }
开发者ID:jcvl92,项目名称:DingusGamingUnturnedPlugin,代码行数:30,代码来源:ArenaEvent.cs

示例5: onPlayerRevive

        private void onPlayerRevive(UnturnedPlayer player, Vector3 position, byte angle)
        {
            LifeUpdated playerRevived = null;
            playerRevived = delegate (bool isDead)
            {
                if (!isDead)
                {
                    //give them the starting item
                    PlayerState.clearInventory(player);
                    if (startItem != 0)
                    {
                        player.GiveItem(startItem, 1);
                        player.Player.Equipment.equip(2, 1, 1);
                    }

                    DGPlugin.teleportPlayerInRadius(player, currentLocation, radius);
                }

                player.Player.PlayerLife.OnUpdateLife -= playerRevived;
            };
            player.Player.PlayerLife.OnUpdateLife += playerRevived;
        }
开发者ID:jcvl92,项目名称:DingusGamingUnturnedPlugin,代码行数:22,代码来源:ArenaEvent.cs

示例6: GiveKit

 public static void GiveKit(UnturnedPlayer player, int KitNumber)
 {
     if (KitNumber == 0) // Prisoner
     {
         player.GiveItem(203, 1); // Orange Daypack
         player.GiveItem(303, 1); // Prisoner Top
         player.GiveItem(304, 1); // Prisoner Bottom
         player.GiveItem(188, 1); // Orange Bandana
         Item colt = UnturnedItems.AssembleItem(97, 7, new Attachment(0, 0), new Attachment(0, 0), new Attachment(0, 0), new Attachment(0, 0), new Attachment(98, 100), EFiremode.SEMI);
         player.GiveItem(colt);  // Colt
         player.GiveItem(98, 10); // Colt Magazine
         player.GiveItem(15, 4); // Medkit
     }
     else if (KitNumber == 1) // Maplestrike
     {
         player.GiveItem(253, 1); // Alicepack
         player.GiveItem(223, 1); // Police Top
         player.GiveItem(224, 1); // Police Bottom
         player.GiveItem(225, 1); // Police Cap
         player.GiveItem(10, 1);  // Police Vest
         Item Maplestrike = UnturnedItems.AssembleItem(363, 30, new Attachment(1004, 100), new Attachment(0, 0), new Attachment(8, 100), new Attachment(7, 100), new Attachment(6, 100), EFiremode.AUTO);
         player.GiveItem(Maplestrike); // Maplestrike
         player.GiveItem(006, 5); // Maplestrike Magazine
         player.GiveItem(15, 4); // Medkit
     }
     else if (KitNumber == 2) // Sniper
     {
         player.GiveItem(235, 1); // Ghillie Top
         player.GiveItem(236, 1); // Ghillie Bottom
         player.GiveItem(238, 1); // Ghillie Vest
         player.GiveItem(202, 1); // Green Daypack
         Item Grizzly = UnturnedItems.AssembleItem(297, 5, new Attachment(1004, 100), new Attachment(0, 0), new Attachment(8, 100), new Attachment(0, 0), new Attachment(298, 100), EFiremode.SEMI);
         player.GiveItem(Grizzly);
         player.GiveItem(298, 10); // Grizzly Magazine
         player.GiveItem(15, 4); // Medkit
     }
 }
开发者ID:RocketLOL,项目名称:BattleRoyale,代码行数:37,代码来源:Kits.cs


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