Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- [6010] = {
- gemid = 5295,
- [2392] = {2, 7522},
- [5249] = {4, 7523},
- [1002] = {5, 10002},
- },
- [6011] = {
- gemid = 1234,
- [1000] = {3, 10001},
- [1001] = {4, 10002},
- [1002] = {5, 10002},
- },
- [6012] = {
- gemid = 1234,
- [1000] = {3, 10001},
- [1001] = {4, 10002},
- [1002] = {5, 10002},
- },
- [6013] = {
- gemid = 1234,
- [1000] = {3, 10001},
- [1001] = {4, 10002},
- [1002] = {5, 10002},
- }
- }
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- if item.itemid == 1945 then
- if config[item.actionid] then
- local stoisko = config[item.actionid]
- local leftPos = {x = fromPosition.x - 1, y = fromPosition.y, z = fromPosition.z, stackpos = 255}
- local rightPos = {x = fromPosition.x + 1, y = fromPosition.y, z = fromPosition.z, stackpos = 255}
- if stoisko[getThingFromPos(leftPos).itemid] then
- -----------item znajduje sie w configu
- local wpcnfg = stoisko[getThingFromPos(leftPos).itemid]
- local thing = getThingFromPos(rightPos)
- if thing then
- if thing.itemid == stoisko.gemid then
- -------------to jest gem
- if thing.type >= wpcnfg[1] then
- doRemoveItem(thing.uid, wpcnfg[1])
- doTransformItem(getThingFromPos(leftPos).uid, wpcnfg[2])
- doSendMagicEffect(leftPos, CONST_ME_EXPLOSIONAREA)
- doSendMagicEffect(rightPos, CONST_ME_POFF)
- doSendAnimatedText(fromPosition, "Done!", TEXTCOLOR_RED)
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough gems.")
- end
- end
- end
- else
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This item can't be changed.")
- end
- end
- end
- return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement