Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Fix for dummy and inventory dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
joker-119 committed Aug 20, 2020
1 parent 779c83b commit 36c8293
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions AdminTools/EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,6 @@ private void SpawnDummyModel(Vector3 position, Quaternion rotation, RoleType rol
if (ccm == null)
Log.Error("CCM is null, doufus. You need to do this the harder way.");
ccm.CurClass = role;
ccm.RefreshPlyModel();
obj.GetComponent<NicknameSync>().Network_myNickSync = "Dummy";
obj.GetComponent<QueryProcessor>().PlayerId = 9999;
obj.GetComponent<QueryProcessor>().NetworkPlayerId = 9999;
Expand Down Expand Up @@ -1656,15 +1655,15 @@ public IEnumerator<float> DoRocket(Player player, float speed)

public IEnumerator<float> DoJail(Player player, bool skipadd = false)
{
List<ItemType> items = new List<ItemType>();
List<Inventory.SyncItemInfo> items = new List<Inventory.SyncItemInfo>();
foreach (Inventory.SyncItemInfo item in player.Inventory.items)
items.Add(item.id);
items.Add(item);
if (!skipadd)
plugin.JailedPlayers.Add(new Jailed
{
Health = player.Health,
Position = player.Position,
Items = items,
Items = items,
Name = player.Nickname,
Role = player.Role,
Userid = player.UserId,
Expand All @@ -1681,8 +1680,7 @@ private IEnumerator<float> DoUnJail(Player player)
{
Jailed jail = plugin.JailedPlayers.Find(j => j.Userid == player.UserId);
player.Role = jail.Role;
foreach (ItemType item in jail.Items)
player.Inventory.AddNewItem(item);
player.ResetInventory(jail.Items);
yield return Timing.WaitForSeconds(1.5f);
player.Health = jail.Health;
player.Position = jail.Position;
Expand Down
2 changes: 1 addition & 1 deletion AdminTools/Jailed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Jailed
{
public string Userid;
public string Name;
public List<ItemType> Items;
public List<Inventory.SyncItemInfo> Items;
public RoleType Role;
public Vector3 Position;
public float Health;
Expand Down

0 comments on commit 36c8293

Please sign in to comment.