private void OnPlayerInit(BasePlayer player) { Backpack backpack = Backpack.LoadOrCreate(player.userID); if (permission.UserHasPermission(player.UserIDString, "backpacks.use") && Configuration.ShowOnBack) { if (backpack.Inventory.Items.Count == 0 && Configuration.HideOnBackIfEmpty) { return; } backpack.SpawnVisual(player); } }
private void OnUserPermissionGranted(string id, string perm) { if (perm == "backpacks.use" && Configuration.ShowOnBack) { BasePlayer player = BasePlayer.Find(id); Backpack backpack = Backpack.LoadOrCreate(player.userID); if (backpack.Inventory.Items.Count == 0 && Configuration.HideOnBackIfEmpty) { return; } backpack.SpawnVisual(player); } }
private void OnPlayerInit(BasePlayer player) { Backpack backpack = Backpack.LoadOrCreate(player.userID); //=====> Bind hotkey player.SendConsoleCommand($"bind {Configuration.BackpackHotkey} backpack.open"); //=====> Spawn visual backpack if (permission.UserHasPermission(player.UserIDString, "backpacks.use") && Configuration.ShowOnBack) { if (backpack.Inventory.Items.Count == 0 && Configuration.HideOnBackIfEmpty) { return; } backpack.SpawnVisual(player); } }