function onUse(cid, item, frompos, item2, topos)
if item.actionid == 21000 then -- BP SD
local cost = 10000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2003, 2268, 1, 10000, 10) -- Gives Gray BP to player, with 20 SD runes, each with 10 charges
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Sudden Death Runes for "10000" gold pieces.")
else
return 1
doPlayerSendCancel(cid,'You need '10000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21001 then -- BP Mana Potions
local cost = 1000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2001, 7620, 1, 1000, 0) -- Gives Purple BP to player, with 20 mana potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Mana Potions for "1000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '1000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21002 then -- BP Strong Mana Potion
local cost = 2000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2001, 7589, 1, 2000, 0) -- Gives Purple BP to player, with 20 strong mana potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Strong Mana Potions for "2000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '2000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21003 then -- BP Great Mana Potion
local cost = 3000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2001, 7590, 1, 3000, 0) -- Gives Purple BP to player, with 20 great mana potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Great Mana Potions for "3000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '3000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21004 then -- BP Health Potion
local cost = 1000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2000, 7618, 1, 1000, 0) -- Gives Red BP to player, with 20 health potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Health Potions for "1000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '1000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21005 then -- BP Strong Health Potion
local cost = 2000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2000, 7588, 1, 2000, 0) -- Gives Red BP to player, with 20 strong health potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Strong Health Potions for "2000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '2000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21006 then -- BP Great Health Potion
local cost = 3000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2000, 7591, 1, 3000, 0) -- Gives Red BP to player, with 20 great health potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Great Health Potions for "3000" gold pieces.")
else
doPlayerSendCancel(cid,'You need '3000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21007 then -- BP Magic Wall Rune
local cost = 10000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 1999, 2293, 1, 1000, 10) -- Gives yellow BP to player, with 20 MW runes, each with 10 charges
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Magic Wall Runes for "1000" gold pieces.")
return 1
else
doPlayerSendCancel(cid,'You need '1000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21008 then -- BP Ultimate Healing Rune
local cost = 2000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2002, 2273, 1, 2000, 10) -- Gives blue BP to player, with 20 UH runes, each with 10 charges
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Ultimate Healing Runes for "2000" gold pieces.")
return 1
else
doPlayerSendCancel(cid,'You need '2000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21009 then -- BP Great Spirit Potion
local cost = 3000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2002, 8472, 1, 3000, 0) -- Gives blue BP to player, with 20 great spirit potions
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Great Spirit Potions for "3000" gold pieces.")
return 1
else
doPlayerSendCancel(cid,'You need '3000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
elseif item.actionid == 21010 then -- BP Ultimate Healing Potion
local cost = 4000
if getPlayerMoney(cid) >= cost then
if getPlayerFreeCap(cid) >= 54 then
doPlayerBuyItemContainer(cid, 2000, 8473, 1, 4000, 10) -- Gives red BP to player, with 20 ultimate healing potion
doPlayerSendTextMessage(cid, 24, "You bought a backpack of Ultimate Healing Potions for "4000" gold pieces.")
return 1
else
doPlayerSendCancel(cid,'You need '4000' gold pieces to buy this item.')
end
else
doPlayerSendCancel(cid,'You need more capacity.')
end
return 1
end
end