addserver function to set inventory show
This commit is contained in:
@@ -769,7 +769,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
if (!player.IsLoggedIn() || player.GetData<bool>("isDead")) return;
|
||||
if (player.GetData<bool>("isDead")) return;
|
||||
|
||||
player.TriggerEvent("inventoryShow");
|
||||
player.ToggleInventory();
|
||||
InventoryManager.SetBackpackItems(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -477,5 +477,17 @@ namespace ReallifeGamemode.Server.Extensions
|
||||
if (player.GetUser().Wanteds > 0)
|
||||
PositionManager.cuffPoints.Add(player);
|
||||
}
|
||||
|
||||
public static void ToggleInventory(this Player player, InventoryToggleOption option = InventoryToggleOption.TOGGLE)
|
||||
{
|
||||
if(option == InventoryToggleOption.TOGGLE)
|
||||
{
|
||||
player.TriggerEvent("inventoryShow");
|
||||
}
|
||||
else
|
||||
{
|
||||
player.TriggerEvent("inventoryShow", option == InventoryToggleOption.SHOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
ReallifeGamemode.Server/Util/InventoryToggleOption.cs
Normal file
11
ReallifeGamemode.Server/Util/InventoryToggleOption.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Server.Util
|
||||
{
|
||||
public enum InventoryToggleOption
|
||||
{
|
||||
TOGGLE, SHOW, HIDE
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user