K-Relay Plugin Help
Hello, so the ring switch plugin i made has some defects. Sometimes, while im playing, and the plugin tries to switch rings i get the "error" sound ingame and nothing happens, as if it failed to move the ring. Does anyone know what might be the cause of this? Thanks!
Edit:
seems to be movement based as when i am still or moving slowly it works better
code that switches items goes like:
InvSwapPacket swap = (InvSwapPacket)Packet.Create(PacketType.INVSWAP);
swap.Time = client.Time;
swap.Position = client.PlayerData.Pos;
swap.SlotObject1 = new SlotObject();
swap.SlotObject2 = new SlotObject();
swap.SlotObject1.ObjectId = client.ObjectId;
swap.SlotObject2.ObjectId = client.ObjectId;
swap.SlotObject1.SlotId = 3; // 0 corresponds to the weapon. 0-3 are equips
swap.SlotObject2.SlotId = 7; // 4 is the first inventory slot
swap.SlotObject1.ObjectType = (short)client.PlayerData.Slot[3]; // ObjectType of whatever is currently in the matching slotId
swap.SlotObject2.ObjectType = (short)client.PlayerData.Slot[7]; // ObjectType of whatever is currently in the matching slotId
client.SendToServer(swap);