got this script
and gets this error
what are im doing wrong?
Code:
local config = {
[5001] = {potion = 7618, cost = 5000, charges = 100, storage = 5001}, -- health potion
[5002] = {potion = 7588, cost = 10000, charges = 100}, -- strong health potion
[5003] = {potion = 7591, cost = 19000, charges = 100}, -- great health potion
[5004] = {potion = 8473, cost = 31000, charges = 100},
[5005] = {potion = 7620, cost = 5000, charges = 100}, -- mana potion
[5006] = {potion = 7589, cost = 8000, charges = 100}, -- string mana potion
[5007] = {potion = 7590, cost = 12000, charges = 100}, -- great mana potion
[5008] = {potion = 8472, cost = 19000, charges = 100},
[5009] = {potion = 2273, cost = 17500, charges = 100},
[5010] = {potion = 2268, cost = 35000, charges = 100},
[5011] = {potion = 2278, cost = 700000, charges = 100},
[5012] = {potion = 2313, cost = 25000, charges = 100},
[5013] = {potion = 2798, cost = 50000, charges = 100},
[5014] = {potion = 2789, cost = 1000, charges = 100},
[5015] = {potion = 2269, cost = 16000, charges = 100},
[5016] = {potion = 2305, cost = 11700, charges = 100},
[5018] = {potion = 2261, cost = 4500, charges = 100},
[5019] = {potion = 2260, cost = 1000, charges = 100},
} -- 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, 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
and gets this error
Code:
[30/12/2013 22:49:08] [Error - Action Interface]
[30/12/2013 22:49:08] data/actions/scripts/potions.lua:onUse
[30/12/2013 22:49:09] Description:
[30/12/2013 22:49:09] (luaDoCreateItemEx) Item not found
[30/12/2013 22:49:09] [Error - Action Interface]
[30/12/2013 22:49:09] data/actions/scripts/potions.lua:onUse
[30/12/2013 22:49:09] Description:
[30/12/2013 22:49:09] data/lib/050-function.lua:23: 'for' limit must be a number
[30/12/2013 22:49:09] stack traceback:
[30/12/2013 22:49:09] data/lib/050-function.lua:23: in function 'doPlayerGiveItemContainer'
[30/12/2013 22:49:09] data/lib/050-function.lua:62: in function 'doPlayerBuyItemContainer'
[30/12/2013 22:49:09] data/actions/scripts/potions.lua:27: in function <data/actions/scripts/potions.lua:22>
what are im doing wrong?