HeberPcL
[PowerOT.com.br]
PHP:
local items = {
["first bless"] = { price = 10000, bless = 1 },
["second bless"] = { price = 10000, bless = 2 },
["third bless"] = { price = 10000, bless = 3 },
["fourth bless"] = { price = 10000, bless = 4 },
["fifth bless"] = { price = 10000, bless = 5 }
}
function onSay(cid, words, param)
local item = items[param]
if item then
if getPlayerBlessing(cid, item.bless) then
doPlayerSendTextMessage(cid, 24, "You already have that blessing.")
elseif isPremium(cid) == TRUE then
if doPlayerRemoveMoney(cid, item.price) == TRUE then
doPlayerSendTextMessage(cid, 24, "Alice has sent her spirit to give you your" .. item .. "ing for" .. item.price .. "gold coins.")
doPlayerAddBlessing(cid, item.bless)
else
doPlayerSendTextMessage(cid, 24, "You need" .. item .. "ing for" .. items.price .. "gold coins.")
end
else
doPlayerSendTextMessage(cid, 24, "Alice's spirit reminds you, that you need premium to buy blessing.")
end
else
-- Sends the player a message wich includes items he can buy --
doPlayerSendTextMessage ( cid, 24, 'You can buy the following items:' )
-- Getting all the itemnames --
for item1 in pairs (items) do
-- Sends a message with each itemname and price --
doPlayerSendTextMessage ( cid, 24, item1 )
-- Ends the for function--
end
-- ends the itemname check --
end
return TRUE
end
Return in default:
PHP:
[03/11/2008 23:19:07] Lua Script Error: [TalkAction Interface]
[03/11/2008 23:19:07] data/talkactions/scripts/powerot/bless system.lua:onSay
[03/11/2008 23:19:07] data/talkactions/scripts/powerot/bless system.lua:19: attempt to concatenate field 'price' (a nil value)
[03/11/2008 23:19:07] stack traceback:
[03/11/2008 23:19:07] data/talkactions/scripts/powerot/bless system.lua:19: in function <data/talkactions/scripts/powerot/bless system.lua:9>
What this is bug?