Sherlok
Active Member
Hiho,
Mógłby ktoś naprawić mi poniższe dwa skrypt, aby działały na 0.3.6pl1?
Błąd:
Skrypt:
____________________________________________
Błąd:
Skrypt:
Z góry dzięki
Pozdrawiam,
Sherlok
Mógłby ktoś naprawić mi poniższe dwa skrypt, aby działały na 0.3.6pl1?
Błąd:
Code:
[Error - Action Interface]
data/actions/scripts/sherlok/runes.lua:onUse
Description:
data/actions/scripts/sherlok/runes.lua:20: attempt to index local 'potion' (a ni
l value)
stack traceback:
data/actions/scripts/sherlok/runes.lua:20: in function <data/actions/scr
ipts/sherlok/runes.lua:15>
Skrypt:
LUA:
local config = {
[1248] = {potion = 2268, cost = 6500, backpack_id = 2003, charges = 9}, -- sudden death rune
[1249] = {potion = 2269, cost = 6400, backpack_id = 2002, charges = 6}, -- wild growth rune
[1250] = {potion = 2274, cost = 3600, backpack_id = 2002, charges = 12}, -- avalanche rune
[1251] = {potion = 2305, cost = 7000, backpack_id = 2000, charges = 6}, -- fire bomb rune
[1252] = {potion = 2308, cost = 4200, backpack_id = 2000, charges = 9}, -- soulfire rune
[1253] = {potion = 2278, cost = 14000, backpack_id = 5949, charges = 3}, -- paralyze rune
[1254] = {potion = 2273, cost = 3500, backpack_id = 2002, charges = 3}, -- ultimate healing rune
[1255] = {potion = 2261, cost = 900, backpack_id = 2003, charges = 9}, -- destroy field rune
[1256] = {potion = 2293, cost = 7000, backpack_id = 2004, charges = 9}, -- magic wall rune
} -- 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, potion.charges) == 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
____________________________________________
Błąd:
Code:
[Error - Action Interface]
data/actions/scripts/sherlok/potions.lua:onUse
Description:
data/actions/scripts/sherlok/potions.lua:18: attempt to index local 'potion' (a
nil value)
stack traceback:
data/actions/scripts/sherlok/potions.lua:18: in function <data/actions/s
cripts/sherlok/potions.lua:13>
Skrypt:
LUA:
local config = {
[1240] = {potion = 7618, cost = 1000}, -- health potion
[1241] = {potion = 7588, cost = 2500}, -- strong health potion
[1242] = {potion = 7591, cost = 5000}, -- great health potion
[1243] = {potion = 8473, cost = 6200}, -- ultimate healing rune
[1244] = {potion = 7620, cost = 5000}, -- mana potion
[1245] = {potion = 7589, cost = 5000}, -- string mana potion
[1246] = {potion = 7590, cost = 5000}, -- great mana potion
[1247] = {potion = 8472, cost = 3800}, -- great spirit 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 doPlayerBuyItem(cid, potion.potion, 1, potion.cost, 1) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have bought "..getItemNameById(potion.potion).." for "..potion.cost.." gold coins.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..potion.cost.." gold pieces to buy "..getItemNameById(potion.potion)..".")
end
return TRUE
end
Z góry dzięki
Pozdrawiam,
Sherlok