--: Configs :--
local storage = 32143 --: Script storage, same on all files
local msg = "Lucky Coins are used here to buy vip items by playing the game. You can buy it at our website shop." --: Message to show
local msgtwo = "You can view your luckycoins by typing !luckycoins amount. view Shop by typing !luckycoins buy." --: If there's no param on command
local msgbuy = "These are the items that you can buy: Soft Boots"
local modalid = 1053 --: Same as luckycoinstalk
local key = player:addItem(2091, 1)
if key then
key:setActionId(26194)
end
--: AMOUNT :--
local qtdtext = "You have" --: For translation issues
--: BUY :--
local title = "Buy items with your lucky coins!" --: Modal Title text
local message = "Click to buy a item!" --: Modal text
--: ITENS TO SELL FOR LUCKY COINS :--
-- [ITEM ID] = {price = <ITEM PRICE>},
lucky_items = {
[6132] = {price = 12}, -- Pair of Soft Boots
[9933] = {price = 12}, -- Firewalker Boots
[2091] = {price = 6} -- Advanced Training room key +x4 skill rate --item, 'aid', 26194
}
ordem = {}
-- Limit of ~250 items i guess
function onSay(player, words, param)
local storageatual = player:getStorageValue(storage)
local plural = "s"
local qtd = ""
if (storageatual < 0) then storageatual = 0 player:setStorageValue(storage, 0) end
if (storageatual == 1) then plural = "" end
qtd = " " .. qtdtext .. " " .. storageatual .. " lucky coin" .. plural .. "."
if (param == "amount") then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, qtd)
elseif (param == "buy") then
--if (onlypz == 1 and player:isPzLocked()) then player:sendCancelMessage('You are not in protection zone.') return false end adições futuras
for k in pairs (ordem) do ordem [k] = nil end
player:registerEvent("ModalWindow_LuckyCoins")
local window = ModalWindow(modalid, title, message .. qtd)
window:addButton(100, "Buy")
window:addButton(101, "Cancel")
for k in pairs(lucky_items) do
table.insert(ordem, k)
end
table.sort(ordem)
for i = 1, #ordem do
local k, v = ordem[i], lucky_items[ ordem[i] ]
window:addChoice(i, string.upper((ItemType(k):getName())) .. " - " .. lucky_items[k].price .. " " .. "lucky coin(s)")
end
window:setDefaultEnterButton(100)
window:setDefaultEscapeButton(101)
window:sendToPlayer(player)
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg .. " " .. msgtwo)
end
return false
end