changegold.lua

main 20 lines · 546 bytes Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local config = {
2 [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN},
3 [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN},
4 [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN}
5}
6
7function onUse(player, item, fromPosition, target, toPosition, isHotkey)
8 local coin = config[item:getId()]
9 if coin.changeTo and item.type == 100 then
10 item:remove()
11 player:addItem(coin.changeTo, 1)
12 elseif coin.changeBack then
13 item:remove(1)
14 player:addItem(coin.changeBack, 100)
15 else
16 return false
17 end
18 return true
19end
20
Top