Skip to content

Instantly share code, notes, and snippets.

@vankk
Created March 22, 2020 13:56
Show Gist options
  • Save vankk/fb86382a168483093354efe512eea700 to your computer and use it in GitHub Desktop.
Save vankk/fb86382a168483093354efe512eea700 to your computer and use it in GitHub Desktop.
Script do Tata com Storage para o Vinicius.
function onModalWindow(cid, modalWindowId, buttonId, choiceId)
cid:unregisterEvent("potions_lever")
local id_Potions = {23589, 32069, 34699, 21403, 34587, 34628, 34641} -- id das potions
local price = {80000000, 100000000, 60000000, 30000000, 40000000, 50000000, 20000000} -- price 1x
local cap = {2.70, 2.70, 2.90, 2.90, 3.10, 3.10, 3.10, 3.10, 3.10, 3.10, 3.50} -- capacity
if cid:getStorageValue(33333) == 1 then
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você já pegou a sua recompensa.")
return false
end
if modalWindowId == 1000 then
if buttonId == 103 then -- botão de compra de 1 item (potion)
if cid:getMoney() >= price[choiceId] then
if cid:getFreeCapacity() >= cap[choiceId] then
cid:removeMoney(price[choiceId])
cid:addItem(id_Potions[choiceId],1)
cid:setStorageValue(33333, 1)
cid:getPosition():sendMagicEffect(15)
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você comprou um item.")
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não tem capacidade suficiente.")
cid:getPosition():sendMagicEffect(10)
end
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Você não tem dinheiro suficiente.")
end
end
if buttonId == 101 then -- botão de compra de 1 item (potion)
if cid:getMoney() >= price[choiceId]*50 then
if cid:getFreeCapacity() >= cap[choiceId]*50 then
cid:removeMoney(price[choiceId]*50)
cid:addItem(id_Potions[choiceId],1*50)
cid:setStorageValue(33333, 1)
cid:getPosition():sendMagicEffect(15)
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought 50x potions")
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough capacity.")
cid:getPosition():sendMagicEffect(10)
end
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "you do not have enough money.")
end
end
if buttonId == 102 then -- botão de compra de 1 item (potion)
if cid:getMoney() >= price[choiceId]*100 then
if cid:getFreeCapacity() >= cap[choiceId]*100 then
cid:removeMoney(price[choiceId]*100)
cid:addItem(id_Potions[choiceId],1*100)
cid:setStorageValue(33333, 1)
cid:getPosition():sendMagicEffect(15)
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You bought 100x potions")
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough capacity.")
cid:getPosition():sendMagicEffect(10)
end
else
cid:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "you do not have enough money.")
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment