HelpK-Relay Plugin Help

Posts 12 of 2 · Page 1 of 1
K-Relay Plugin Help
Hello,
I'm trying to write a plugin for K-Relay (my first ) but I am having trouble trying to send the client the command to use/equip an item. Could someone tell me the code that would be required to use/equip an item that is in a certain slot and the correct numbering for them (I'm assuming from other threads that it is 0-11 with 0-3 being equips). I have not included a picture of my code as I thought it was not needed but i can do that if anybody wishes.
Thanks!
Code:
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 = 0; // 0 corresponds to the weapon. 0-3 are equips
swap.SlotObject2.SlotId = 4; // 4 is the first inventory slot
swap.SlotObject1.ObjectType = client.PlayerData.Slot[0]; // ObjectType of whatever is currently in the matching slotId
swap.SlotObject2.ObjectType = client.PlayerData.Slot[4]; // ObjectType of whatever is currently in the matching slotId

client.SendToServer(swap);
I think PlayerData.Slot works that way. I kept track of that stuff manually in RR and in the scripts I converted to KR. Which slotObject has which item doesn't matter. The server will swap them and the client will register the swap on the next new_tick.
Posts 12 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?