Lbtg
Intermediate OT User
- Joined
- Nov 22, 2008
- Messages
- 2,326
- Reaction score
- 136
Well i found on forums much bless boooks but this was most nice and + i lil edited it and i recieve error
What im doing wrong
error.
was trying to fix it for long but always fail to make fully working ^^
blessbook.lua
What im doing wrong
error.
HTML:
[10:0:46.383] [Error - LuaInterface::loadFile] data/actions/scripts/blessbook1charge.lua:12: 'end' expected (to close 'for' at line 6) near 'else'
[10:0:46.383] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/blessbook1charge.lua)
[10:0:46.383] data/actions/scripts/blessbook1charge.lua:12: 'end' expected (to close 'for' at line 6) near 'else'
was trying to fix it for long but always fail to make fully working ^^
blessbook.lua
PHP:
local cfg = {
bless = { 1, 2, 3, 4, 5 },
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
for i = 1, table.maxn(cfg.bless) do
if(getPlayerBlessing(cid, cfg.bless[i])) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendCancel(cid, "You have already recieved Blessings!")
return true
end
else
doCreatureSetDropLoot(cid, false)
doRemoveItem(cid, item.uid, 1)
doPlayerAddBlessing(cid, cfg.bless[i])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
end
return true
end