hmm, AID, map_id2sd() need AID, not CID. and when use AID, map_id2sd() will find the online sd based on AID, only 1 online AID at same time right?
well, I think I make new release post about modified countitem <item_id> becomes countitem <item_id/"item_name">{,<location>}{,<AID/"nick">} first, and you can review the source, regarding this post is talking about atcommand, don't want to 'out-of-topic'.. haha
@topic, I didn't make countitem for guild storage becase, as far as I know to access guild storage, player has to open guild storage first.
example on @cleargstorage's lines
gstorage = guild2storage2(sd->status.guild_id);
if (gstorage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there.
return -1;
}