Exemplo n.º 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer callr   = (UnturnedPlayer)caller;
            string         kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName;

            if (!KitManager.HasSavedKits(callr, KitManager.Kits))
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red);
                return;
            }

            if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name")
            {
                foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets)
                {
                    if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name))
                    {
                        kitName = Preset.Name;
                    }
                }
            }

            if (command.Length == 1)
            {
                kitName = command[0];
            }

            if (kitName == "*")
            {
                if (KitManager.HasSavedKits(callr, KitManager.Kits))
                {
                    UnturnedChat.Say(callr, Plugin.CustomKitsPlugin.Instance.Translate("are_you_sure"), Color.yellow);

                    if (!Yes.Contains(callr.CSteamID))
                    {
                        Yes.Add(callr.CSteamID);
                        return;
                    }
                }
                else
                {
                    UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red);
                    return;
                }
            }

            if (KitManager.HasKit(callr, kitName, KitManager.Kits))
            {
                KitManager.DeleteKit(callr, kitName, KitManager.Kits);
            }
            else
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red);
                return;
            }

            UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_deleted", kitName), Color.green);
        }
Exemplo n.º 2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer callr   = (UnturnedPlayer)caller;
            string         kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName;

            if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name")
            {
                foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets)
                {
                    if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name))
                    {
                        kitName = Preset.Name;
                    }
                }
            }

            if (command.Length == 1)
            {
                kitName = command[0];
            }

            if (!KitManager.HasSavedKits(callr, KitManager.Kits))
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red);
                return;
            }

            if (!KitManager.HasKit(callr, kitName, KitManager.Kits))
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red);
                return;
            }

            InventoryManager.Clear(callr, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits);
            KitManager.LoadKit(callr, callr, kitName, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits, KitManager.Kits);

            UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_loaded", kitName), Color.green);
        }
Exemplo n.º 3
0
        private void OnPlayerRevive(UnturnedPlayer player, Vector3 position, byte angle)
        {
            if (Commands.Command_AutoSkills.AutoSkills.Contains(player.CSteamID))
            {
                player.MaxSkills();
                UnturnedChat.Say(player, Translate("max_skills"), Color.green);
            }

            if (Commands.Command_AutoCopy.AutoCopy.Contains(player.CSteamID))
            {
                InventoryManager.AutoCopy(player);
            }

            if (Commands.Command_AutoSave.AutoSave.ContainsKey(player.CSteamID))
            {
                KitManager.AutoSave(player);
            }

            if (Commands.Command_AutoLoad.AutoLoad.ContainsKey(player.CSteamID))
            {
                string kitName = Commands.Command_AutoLoad.AutoLoad[player.CSteamID];

                if (!KitManager.HasSavedKits(player, KitManager.Kits))
                {
                    UnturnedChat.Say(player, Instance.Translate("no_saved_kits"), Color.red);
                    return;
                }

                if (!KitManager.HasKit(player, kitName, KitManager.Kits))
                {
                    UnturnedChat.Say(player, Translate("no_kit_exists"), Color.red);
                    return;
                }

                StartCoroutine(KitManager.DelayedLoad(player, kitName, 0.3f));
            }
        }