Majesty 1,755 #1 Posted March 16, 2021 Citar Nome: [Revscriptsys] Lever Shop Versão: [10.98+] // Compatível com TFS 1.3 / OTServBR-Global Tipo do script: Action Créditos: Eduardo170 (Scripts originais: https://otland.net/threads/tfs-1-3-lever-shop.268777/) data/scripts/actions/lever_shop.lua: Spoiler local shop = { [2051] = {id = 2494, cost = 10000, count = 1}, [2052] = {id = 2495, cost = 1000, count = 1}, [2053] = {id = 2496, cost = 1000, count = 1}, [2054] = {id = 2497, cost = 10000, count = 1}, [2055] = {id = 2498, cost = 10000, count = 1}, } local leverShop = Action() function leverShop.onUse(player, item, fromPosition, target, toPosition, isHotkey) local ShopItem = shop[item.uid] local itemType = ItemType(ShopItem.id) if ShopItem then if(not player:removeMoney(ShopItem.cost)) then player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need '..ShopItem.cost..' to buy '.. itemType:getName() .. '.') return false end player:addItem(ShopItem.id, ShopItem.count) player:removeMoney(ShopItem.cost) player:sendTextMessage(MESSAGE_INFO_DESCR, 'You bought a '.. itemType:getName() .. '.') player:getPosition():sendMagicEffect(13) end return true end for index, value in pairs(shop) do leverShop:uid(index) end leverShop:register() data/scripts/actions/lever_shop_transform_items.lua: Spoiler local lever_id = 1945 -- id of lever before pulled local pulled_id = 1946 -- id of lever after pulled local shop = { [2051] = {id = 2494, cost = 10000, count = 1}, [2052] = {id = 2495, cost = 1000, count = 1}, [2053] = {id = 2496, cost = 1000, count = 1}, [2054] = {id = 2497, cost = 10000, count = 1}, [2055] = {id = 2498, cost = 10000, count = 1}, } local leverShopTransformItems = Action() function leverShopTransformItems.onUse(player, item, fromPosition, target, toPosition, isHotkey) local ShopItem = shop[item.uid] local itemType = ItemType(ShopItem.id) if item.itemid ~= pulled_id then if ShopItem then if(not player:removeMoney(ShopItem.cost)) then player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need '..ShopItem.cost..' to buy '.. itemType:getName() .. '.') return false end item:transform(pulled_id) player:addItem(ShopItem.id, ShopItem.count) player:removeMoney(ShopItem.cost) player:sendTextMessage(MESSAGE_INFO_DESCR, 'You bought a '.. itemType:getName() .. '.') player:getPosition():sendMagicEffect(13) end else item:transform(lever_id) return true end end for index, value in pairs(shop) do leverShopTransformItems:uid(index) end leverShopTransformItems:register() Share this post Link to post