Ratser
Retired // Making time for yoloswagmod
- Joined
- Feb 11, 2009
- Messages
- 482
- Reaction score
- 36
I've seen different scripts for different "backpack of potions switches" but what I want is to merge those into a single script file.
I made this 5 mins ago (sleepy, with lotsa lag and spaghetti [Obviously the script doesn't work {I tested it}]):
I made this 5 mins ago (sleepy, with lotsa lag and spaghetti [Obviously the script doesn't work {I tested it}]):
Code:
local POTIONS = {
[1515] = {cost = 400, backpack = 10519, item = 8704, ammount = 20}, -- small health
potion
[1516] = {cost = 900, backpack = 2000, item = 7618, ammount = 20}, -- health potion
[1517] = {cost = 2000, backpack = 7342, item = 7588, ammount = 20}, -- strong health
potion
[1518] = {cost = 3800, backpack = 10518, item = 7591, ammount = 20}, -- great health
potion
[1519] = {cost = 6200, backpack = 10522, item = 8473, ammount = 20}, -- ultimate
health potion
[1520] = {cost = 1000, backpack = 2001, item = 7620, ammount = 20}, -- mana potion
[1521] = {cost = 1600, backpack = 9974, item = 7589, ammount = 20}, -- strong mana
potion
[1522] = {cost = 2400, backpack = 10521, item = 7590, ammount = 20}, -- great mana
potion
[1523] = {cost = 3800, backpack = 2004, item = 8472, ammount = 20} -- great spirit
potion
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local potion = POTIONS[item.actionid]
if(not potion) then
return false
end
if(doPlayerRemoveMoney(cid, potion.cost)) then
if(getContainerCap(cid)) then
doAddContainerItem(doPlayerAddItem(cid, potion.backpack, 1),
potion.item, potion.ammount)
doSendAnimatedText(fromPosition, "Buy!", TEXTCOLOR_YELLOW)
else
doPlayerSendDefaultCancel(cid,
RETURNVALUE_CONTAINERNOTENOUGHROOM)
end
else
doPlayerSendCancel(cid, "Not enough money.")
end
return true
end