private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { ItemManager.askClearRegionItems(player.Player.movement.region_x, player.Player.movement.region_y); if (Commands.Command_AutoSave.AutoSave.ContainsKey(player.CSteamID)) { string kitName = Commands.Command_AutoSave.AutoSave[player.CSteamID]; KitManager.SaveKit(player, player, kitName, KitManager.AutoSaveKits); } if (Commands.Command_AutoCopy.Murdered.ContainsKey(player.CSteamID)) { Commands.Command_AutoCopy.Murdered.Remove(player.CSteamID); } if (Configuration.Instance.KeepKitsOnDeath == false) { KitManager.DeleteKit(player, "*", KitManager.Kits); } IRocketPlayer mMurderer = UnturnedPlayer.FromCSteamID(murderer); if (!(mMurderer is ConsolePlayer)) { Commands.Command_AutoCopy.Murdered.Add(player.CSteamID, murderer); } }
public void Execute(IRocketPlayer caller, string[] command) { UnturnedPlayer callr = (UnturnedPlayer)caller; string kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName; string presetName = "ADMIN_KIT"; List <InventoryManager.Item> itemList = InventoryManager.ListItems(callr); int inventoryCount = itemList.Count; if (!caller.IsAdmin || !caller.HasPermission("ck.admin")) { string[] blackList = new string[] { }; int itemLimit = int.MaxValue; foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets) { if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name)) { presetName = Preset.Name; if (Preset.Blacklist != "") { blackList = Preset.Blacklist.Split(','); break; } } else { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("set_permissions"), Color.red); return; } } if (KitManager.KitCount(callr, KitManager.Kits) >= SlotManager.SlotCount(callr)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kits_left"), Color.red); return; } var v = KitManager.KitCount(callr, KitManager.Kits); var slot = SlotManager.Slots[callr.CSteamID.m_SteamID][v]; itemLimit = slot.itemLimit; if (blackList.Length > 0) { foreach (InventoryManager.Item item in itemList) { List <int> bList = new List <int>(); foreach (var itemID in blackList) { bList.Add(int.Parse(itemID)); } if (bList.Contains(item.id)) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("blacklisted", UnturnedItems.GetItemAssetById(item.id)), Color.red); } } } if (inventoryCount > itemLimit) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("item_limit", itemLimit), Color.red); return; } } if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name") { kitName = presetName; } if (command.Length == 1) { kitName = command[0]; } if (kitName == "*") { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("unsupported_character", "*"), Color.red); return; } if (inventoryCount < 1 || itemList == null) { UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("empty_inventory"), Color.red); return; } if (KitManager.HasKit(callr, kitName, KitManager.Kits)) { KitManager.DeleteKit(callr, kitName, KitManager.Kits); } KitManager.SaveKit(callr, callr, kitName, KitManager.Kits); UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_saved", kitName), Color.green); }