void RecordInventoryPlayer(NetUser Player) { if (Inventarios.ContainsKey(Player.userID)) { return; } var Ropas = new Colecciones::List <object>(); var Armas = new Colecciones::List <object>(); var CosasInventarios = new Colecciones::List <object>(); var InfoInventario = new Colecciones::Dictionary <string, object>(); IInventoryItem Item; Inventory PlayerInventory = Player.playerClient.rootControllable.idMain.GetComponent <Inventory>(); try { for (int i = 0; i < 40; i++) { if (PlayerInventory.GetItem(i, out Item)) { if (i >= 0 && i < 30) { CosasInventarios.Add(new Colecciones::Dictionary <string, int>() { { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 } }); continue; } if (i >= 30 && i < 36) { Armas.Add(new Colecciones::Dictionary <string, int>() { { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 } }); continue; } Ropas.Add(new Colecciones::Dictionary <string, int>() { { Item.datablock.name, Item.datablock._splittable ? (int)Item.uses : 1 } }); } } InfoInventario.Add("Ropas", new Colecciones::List <object>(Ropas)); InfoInventario.Add("Armas", new Colecciones::List <object>(Armas)); InfoInventario.Add("CosasInventario", new Colecciones::List <object>(CosasInventarios)); Inventarios.Add(Player.userID, new Colecciones::Dictionary <string, object>(InfoInventario)); InfoInventario.Clear(); Ropas.Clear(); Armas.Clear(); CosasInventarios.Clear(); rust.Notice(Player, "Your Inventory Save, if you inventory dont return type /hg Inventory"); PlayerInventory.Clear(); } catch (Exception ex) { Debug.LogError("Error the record Player Inventory in Plugin HungerGames " + ex.Message); } }
void EntraralJuego(NetUser Player) { if (JugadoresenJuego.Count >= MaximoPlayers) { rust.SendChatMessage(Player, SysName, Green + "HungerGames have the max of " + Red + "players " + White + "please wait that the finally of current event"); return; } if (EventoIniciado == true) { rust.SendChatMessage(Player, SysName, Green + "HungerGames already started " + Red + "please wait that the event finally"); return; } if (EventoEncendido == false) { rust.SendChatMessage(Player, SysName, "Hunger Games no esta Iniciado"); return; } if (JugadoresenJuego.Contains(Player) == true) { rust.SendChatMessage(Player, SysName, Green + " You Already in Game"); return; } if (Player.playerClient.GetComponent <PlayerStatus>() == null) { Player.playerClient.gameObject.AddComponent <PlayerStatus>(); } if (Player.playerClient.GetComponent <PlayerStatus>().InGame) { return; } JugadoresenJuego.Add(Player); Players2.Add(Player); RecordInventoryPlayer(Player); PlayersPostions.Add(Player.userID, Player.playerClient.rootControllable.transform.localPosition); ServerController.TeleportPlayerToWorld(Player.networkPlayer, cachedLocationEvent ?? new Vector3(Player.playerClient.transform.localPosition.x, Player.playerClient.transform.localPosition.y, Player.playerClient.transform.localPosition.z)); if (ForceStartEvent) { rust.BroadcastChat(SysName, string.Format(Mensajes["EntroForzado"].ToString(), JugadoresenJuego.Count)); } else { rust.BroadcastChat(SysName, string.Format(Mensajes["EntroNormal"].ToString(), JugadoresenJuego.Count, MaximoPlayers)); } timer.Once(1f, () => { PlayerFreezer(Player, OptionFroze.PlayerFroze, true); }); timer.Once(3f, () => { PlayerFreezer(Player, OptionFroze.PlayerunFroze, true); }); }
void AgregarPlayeralChat(NetUser Player, string Name) { if (!Player.admin) { rust.Notice(Player, "No Puedes Usar este Comando"); return; } NetUser targeUser = rust.GetAllNetUsers().Where(x => x.displayName.ToLower().Contains(Name.ToLower())).FirstOrDefault(); if (targeUser != null) { if (Players.Contains(targeUser)) { rust.SendChatMessage(Player, TAG, "Ya Esta el Player en el chat"); return; } rust.Notice(targeUser, "Se te Agrego al Chat Grupal"); Players.Add(targeUser); } else { rust.SendChatMessage(Player, "ChatSystem", "No Existe el Player"); } }