private void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject)
{
if (entity.ShortPrefabName.Contains("cupboard.tool"))
{
BasePlayer player = BasePlayer.FindByID(entity.OwnerID);
if (player == null)
{
return;
}
if (!GameStarted)
{
entity.KillMessage();
var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
if (itemtogive != null)
{
player.inventory.GiveItem(itemtogive);
}
SendChatMessage(player, CurrentStartCup);
return;
}
if (RedTeam.Contains(player.userID) && CupBoardRed)
{
entity.KillMessage();
var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
if (itemtogive != null)
{
player.inventory.GiveItem(itemtogive);
}
SendChatMessage(player, CurrentCupLimit);
return;
}
if (BlueTeam.Contains(player.userID) && CupBoardBlue)
{
entity.KillMessage();
var itemtogive = ItemManager.CreateByItemID(-97956382, 1);
if (itemtogive != null)
{
player.inventory.GiveItem(itemtogive);
}
SendChatMessage(player, CurrentCupLimit);
return;
}
if (RedTeam.Contains(player.userID))
{
CupBoardRed = true;
CupBoardRedString = entity.ToString();
SendChatMessage(player, CurrentCupPlaced);
return;
}
if (BlueTeam.Contains(player.userID))
{
CupBoardBlue = true;
CupBoardBlueString = entity.ToString();
SendChatMessage(player, CurrentCupPlaced);
return;
}
}
}