Here's a simple gen sell skript for all of you nerds creating gen servers.
command /sell:
trigger:
sell(player, coal, 1)
sell(player, iron, 5)
add {-temp::%player%} to player's balance
send title "&a&lSOLD" with subtitle "&fYou sold all items for &2&l$%{-temp::%player%}%"
play sound "block.note_block.pling" with volume 2 to player
delete {-temp::%player%}
function sell(P: player, I: itemtype, N: int):
set {_am} to amount of {_I} in {_P}'s inventory
set {_am} to ({_am} * {_N})
remove all {_I} from {_P}'s inventory
add {_am} to {-temp::%{_P}%}