Hello i have a "pull the switch and buy a backpack vials" script but now you can stack the pot's so i wonder if someone can edit this script so you dont get the bp only 20 pots.. ?
Code:
--[[
Potion Script v1.0
by Shawak
]]--
local config = {
[5001] = {potion = 7618, cost = 1000, backpack_id = 2000}, -- health potion
[5002] = {potion = 7588, cost = 1500, backpack_id = 2000}, -- strong health potion
[5003] = {potion = 7591, cost = 3000, backpack_id = 2000}, -- great health potion
[5004] = {potion = 7620, cost = 1000, backpack_id = 2001}, -- mana potion
[5005] = {potion = 7589, cost = 1500, backpack_id = 2001}, -- string mana potion
[5006] = {potion = 7590, cost = 3000, backpack_id = 2001}, -- great mana potion
[5007] = {potion = 8472, cost = 5000, backpack_id = 2001}, -- great mana potion
[5008] = {potion = 8473, cost = 5000, backpack_id = 2000}, -- super great health potion
} -- config end --
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = config[item.uid]
if isInArray({1945, 1946}, item.itemid) ~= TRUE then
return TRUE
end
if doPlayerBuyItemContainer(cid, potion.backpack_id, potion.potion, 1, potion.cost, 1) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You bought a backpack "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold coins for a backpack "..getItemNameById(potion.potion)..".")
end
return TRUE
end