diff --git a/src/packets.c b/src/packets.c index aa1df2e..0daabc1 100644 --- a/src/packets.c +++ b/src/packets.c @@ -653,7 +653,7 @@ int cs_closeContainer (int client_fd) { player->craft_items[i] = 0; player->craft_count[i] = 0; uint8_t client_slot = serverSlotToClientSlot(window_id, 41 + i); - if (client_slot != 255) sc_setContainerSlot(player->client_fd, 0, client_slot, 0, 0); + if (client_slot != 255) sc_setContainerSlot(player->client_fd, window_id, client_slot, 0, 0); } return 0; diff --git a/src/procedures.c b/src/procedures.c index 3a60c60..0831776 100644 --- a/src/procedures.c +++ b/src/procedures.c @@ -172,6 +172,8 @@ uint8_t clientSlotToServerSlot (int window_id, uint8_t slot) { int givePlayerItem (PlayerData *player, uint16_t item, uint8_t count) { + if (item == 0 || count == 0) return 0; + uint8_t slot = 255; uint8_t stack_size = getItemStackSize(item);