you can go to src/map/battle.cpp and find "if (sd->equip_index[EQI_AMMO] >= 0" which is about at line 2470. just add a judge with pc_isequipped function.
it could be:
if (sd->equip_index[EQI_AMMO] >= 0 && !pc_isequipped(sd,<your specified itemid>)) //Qty check should have been done in skill_check_condition
pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
recompile and done.
I tried, it's working.