• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved bless book

Lbtg

Intermediate OT User
Joined
Nov 22, 2008
Messages
2,324
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.
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
 
Of course not. Look where it's..
uff.. you know what? do this

I left it there so you'd see the error in console and try to fix it yourself.

replace this line
Code:
doPlayerAddBlessing(cid, cfg.bless[i])
with this
Code:
doPlayerAddBlessing(cid, cfg.bless[1])
doPlayerAddBlessing(cid, cfg.bless[2])
doPlayerAddBlessing(cid, cfg.bless[3])
doPlayerAddBlessing(cid, cfg.bless[4])
doPlayerAddBlessing(cid, cfg.bless[5])
Code:
for i = 1, 5 do
    doPlayerAddBlessing(cid, cfg.bless[i])
end
thanks works percly, is it posible to add cooldown on use 2 minuteS? :)
 
Code:
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
     end
   
     local exstorage = 45001
     if exhaustion.check(cid, exstorage) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "You are exhausted. Please wait awhile.")
         return true
     end
     exhaustion.set(cid, exstorage, 120)
 
     doCreatureSetDropLoot(cid, false)
     doRemoveItem(item.uid, 1)
     for i = 1, 5 do
         doPlayerAddBlessing(cid, cfg.bless[i])
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
   
     return true
end
 
Code:
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
     end
  
     local exstorage = 45001
     if exhaustion.check(cid, exstorage) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "You are exhausted. Please wait awhile.")
         return true
     end
     exhaustion.set(cid, exstorage, 120)

     doCreatureSetDropLoot(cid, false)
     doRemoveItem(item.uid, 1)
     for i = 1, 5 do
         doPlayerAddBlessing(cid, cfg.bless[i])
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
  
     return true
end
i did like this but had error will try your now :)
PHP:
local cfg = {
   bless = { 1, 2, 3, 4, 5 }
   valid_time = 4 * 60,
   storage = 18027,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

    if (exhaustion.check(cid, cfg.storage) == true) then
        local time = exhaustion.get(cid, cfg.storage)
        local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)      
        if time >= 3600 then
            text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
        elseif time >= 120 then
            text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
        else
            text = seconds.." "..(seconds > 1 and "seconds" or "second")
        end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have to wait " .. text .. " couple of minutes so the book can charge itself!.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
     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
     end
     doCreatureSetDropLoot(cid, false)
     doPlayerAddBlessing(cid, cfg.bless[1])
     doPlayerAddBlessing(cid, cfg.bless[2])
     doPlayerAddBlessing(cid, cfg.bless[3])
     doPlayerAddBlessing(cid, cfg.bless[4])
     doPlayerAddBlessing(cid, cfg.bless[5])
     doSendMagicEffect(getCreaturePosition(cid), 66)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED BY ANCIENT BOOK!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
    
     return true
end
 
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
     end
  
     local exstorage = 18027
     if exhaustion.check(cid, exstorage) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         doPlayerSendCancel(cid, "Ancient Book was just used , you have to wait " .. time .. "  before you can .")
         return true
     end
     exhaustion.set(cid, exstorage, 300)
     doCreatureSetDropLoot(cid, false)
     doRemoveItem(item.uid, 1)
     for i = 1, 5 do
         doPlayerAddBlessing(cid, cfg.bless[i])
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
  
     return true
end
if player uses bless book it shows time how much left to wait ?
 
tryed like this no errors, but it aint working
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
     end
  
    local exstorage = 18027
    if exhaustion.check(cid, expstorage) then
    doPlayerSendCancel(cid, "You are Still Exhausted.Time Left :"..exhaustion.get(cid,expstorage).." Seconds.")
    doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
    end
    exhaustion.set(cid, exstorage, 300)
     doCreatureSetDropLoot(cid, false)
     for i = 1, 5 do
         doPlayerAddBlessing(cid, cfg.bless[i])
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
  
     return true
end
 
.get(cid,EXPSTORAGE)
local EXSTORAGE =
what ? :O

PHP:
18:14:42.043] [Error - LuaInterface::loadFile] data/actions/scripts/blessbook.lua:16: '<name>' expected near 'local'
[18:14:42.043] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/blessbook.lua)
 
local exstorage = 18027
if exhaustion.check(cid, expstorage) then
doPlayerSendCancel(cid, "You are Still Exhausted.Time Left :"..exhaustion.get(cid,expstorage).." Seconds.")
doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
end
exhaustion.set(cid, exstorage, 300)
can you see it now?
 
tryed like this no errors, but it aint working
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
             local player = getCreaturePosition(cid)
             doSendMagicEffect(player, CONST_ME_POFF)
             doPlayerSendCancel(cid, "You have already recieved Blessings!")
             return true
         end
     end

    local exstorage = 18027
    if exhaustion.check(cid, expstorage) then
    doPlayerSendCancel(cid, "You are Still Exhausted.Time Left :"..exhaustion.get(cid, expstorage).." Seconds.")
    doSendMagicEffect(player, CONST_ME_POFF)
    end
    exhaustion.set(cid, exstorage, 300)
     doCreatureSetDropLoot(cid, false)
     for i = 1, 5 do
         doPlayerAddBlessing(cid, cfg.bless[i])
     end
     doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
     doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
     doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")

     return true
end

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
     end

    local exstorage = 18027
    if exhaustion.check(cid, exstorage) then --// wasn't the same as your local
        doPlayerSendCancel(cid, "You are Still Exhausted.Time Left :"..exhaustion.get(cid,exstorage).." Seconds.")
        doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
    end
    for i = 1,5 do
        doPlayerAddBlessing(cid, cfg.bless[i])
        exhaustion.set(cid, exstorage, 300)
        doCreatureSetDropLoot(cid, false)
    end
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
    doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
    doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")
return true
end
 
Last edited:
i don't know why he want exhaustion? when i get bless and use book again will get msg you already blessing so exhaustion not important
 
Is it posible to make that first player who Uses the book become Book owner "you see book of blessing: this item belong to Lbtg" and that player is the only one who can use the book , and if someone else trys to use boook it says"keep your hands away from "name" 'book' "
 
you CAN do it with
Code:
doSetItemActionId(uid, aid)
doSetItemSpecialDescription(uid, txt)
get/set - PlayerStorageValue(...)
getThing(item.uid).actionid
its not really a "good" way, since it binds that item to the player by setting an action id onto it, but no other way i tried i could get it to work...
it does work with action id but i have no idea if that will cause any errors in the long run
 
you CAN do it with
Code:
doSetItemActionId(uid, aid)
doSetItemSpecialDescription(uid, txt)
get/set - PlayerStorageValue(...)
getThing(item.uid).actionid
its not really a "good" way, since it binds that item to the player by setting an action id onto it, but no other way i tried i could get it to work...
it does work with action id but i have no idea if that will cause any errors in the long run
there is any other ways ?
 
This is the last time I'm editing this damn script.
if you get error's change all
Code:
item.aid
item.uid
to
Code:
item.actionid
item.uniqueid
Code:
local cfg = {
    bless = { 1, 2, 3, 4, 5 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if item.aid > 0 then
        if item.aid ~= getPlayerGUID(cid) then
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            doPlayerSendCancel(cid, "Get your filthy hands off Master " .. getPlayerNameByGUID(item.aid) .. "'s Book you thief!")
            return true
        end
    end

    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
    end

    local exstorage = 45001
    if exhaustion.check(cid, exstorage) then
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
        doPlayerSendCancel(cid, "You are exhausted. Please wait awhile.")
        return true
    end
    exhaustion.set(cid, exstorage, 120)

    for i = 1,5 do
        doPlayerAddBlessing(cid, cfg.bless[i])
    end
    doCreatureSetDropLoot(cid, false)
    doSetItemActionId(item.uid, getPlayerGUID(cid))
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
    doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
    doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")

    return true
end
 
Last edited:
This is the last time I'm editing this damn script.
if you get error's change all
Code:
item.aid
item.uid
to
Code:
item.actionid
item.uniqueid
Code:
local cfg = {
    bless = { 1, 2, 3, 4, 5 }
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

    if item.aid > 0 then
        if item.aid ~= getPlayerGUID(cid) then
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
            doPlayerSendCancel(cid, "Get your filthy hands off Master " .. getPlayerNameByGUID(item.aid) .. "'s Book you thief!")
            return true
        end
    end

    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
    end

    local exstorage = 18027
    if exhaustion.check(cid, exstorage) then  
        doPlayerSendCancel(cid, "You are exhausted. Please wait awhile.")
        doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
    end
    exhaustion.set(cid, exstorage, 120)

    for i = 1,5 do
        doPlayerAddBlessing(cid, cfg.bless[i])
    end
    doCreatureSetDropLoot(cid, false)
    doSetItemActionId(item.uid, getPlayerGUID(cid))
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
    doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
    doPlayerSendTextMessage(cid, 21, "You have recieved blessings by Ancient Book!")

    return true
end

Code:
for i = 1,5 do
        doPlayerAddBlessing(cid, cfg.bless[i])
        exhaustion.set(cid, exstorage, 300)
        doCreatureSetDropLoot(cid, false)
    end
this is going to be executed 5 times
 
Code:
for i = 1,5 do
        doPlayerAddBlessing(cid, cfg.bless[i])
        exhaustion.set(cid, exstorage, 300)
        doCreatureSetDropLoot(cid, false)
    end
this is going to be executed 5 times
I changed this a couple minutes ago. I copy pasted tokens edit, assuming it was the same script I posted earlier. >.>
 
Back
Top