Hello,
this is my first post. I've been scripting for a few months now and I have to say I've learned a lot. However, I still have a lot to look up.
I am currently writing a purchase shop and have the following problem.
It actually runs quite well in the functions I've written. BUT custom items (renames, lores, enchantments) will also be affected. These should not be counted or removed. One function is buy per stack and the other function is buy inventory. I hope you can help me.
this is my first post. I've been scripting for a few months now and I have to say I've learned a lot. However, I still have a lot to look up.
I am currently writing a purchase shop and have the following problem.
It actually runs quite well in the functions I've written. BUT custom items (renames, lores, enchantments) will also be affected. These should not be counted or removed. One function is buy per stack and the other function is buy inventory. I hope you can help me.
Code:
function takeitem_l(i: item, m: number, c: number, p: player):
set {_item} to {_i}
set {_cost} to {_c}
set {_maxstack} to {_m}
if {_item} is not air:
if {_cost} > 0:
if {_p} has {_maxstack} of {_item}:
remove {_maxstack} of {_item} from {_p}'s inventory
set {_money} to {_cost}
execute console command "eco give %{_p}% %{_money}%"
else:
message "Du hast nicht genügend Items" to {_p}
function takeitem_r(i: item, m: number, c: number, p: player):
set {_item} to {_i}
set {_cost} to {_c}
set {_maxstack} to {_m}
if {_item} is not air:
if {_cost} > 0:
set {_amount} to amount of {_item} in {_p}'s inventory
if {_amount} > 0:
set {_stacks} to floor({_amount}/{_maxstack})
set {_amountr} to {_stacks} * {_maxstack}
set {_money} to {_cost} * {_stacks}
remove {_amountr} of {_item} from {_p}'s inventory
execute console command "eco give %{_p}% %{_money}%"
else:
message "Du hast nicht genügend Items" to {_p}