I timed it closely so the time that it gives your items to you, and takes the xp is only 1 game tick difference (1/10th of a second), First gives the items, then 1 tick later deducts xp. I posted a world download if you wanted to check it out yourself. If you want to know about a redstone tick click here.
Also heres the code.
Give Command:
/give @p[lm=10] 267
Xp Deduction Command:
/xp -10L @p[lm=10]
I think that you should deduct the xp first, so if they have 0 xp levels then they don't get the item beforehand
Alright, here is the situation. I'm setting up various xp shops that will take for ex; 5 exp from player and give them said item with said enchantment. Now I don't have a problem getting the item part to work. It's the exp part that I'm stuck on. The issue is that say I only have 2 exp and try to buy and item that cost 10 exp, it will give the nearest player online at the time with sufficent exp the item an subtract the exp from them. My question is how would I be able to fix this so that it won't charge other players and only just effect the player using it? Would it be possible to add it a radius that would only effect players with say 5 blocks? Let me know what you think. Thanks in advance
I think that you should deduct the xp first, so if they have 0 xp levels then they don't get the item beforehand
It would work any way,
/give @p[lm=10]
^ They have to have a level minimum of 10 levels
/xp -10L @p[lm=10]
^ Same thing