• 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!

Blessing book

Scorpvm

Member
Joined
Feb 23, 2010
Messages
434
Solutions
3
Reaction score
16
Location
Spain
Hi guys,
It's possible make one blessing book what have 5charge?
 
This should work:

Lua:
function onUse(cid, item, frompos, item2, topos) 
local maxbless = 5 --think 5 is standard dunno just change to how much times the player is blessed per usage of the book
local bookcharges = 5 --change to how many times it can be used.

local t = string.explode(getItemSpecialDescription(item.uid), " ")
local charges = t[1]
      for i = 1,maxbless do
          if getPlayerBlessing(cid, i) then
             if i == maxbless then
                doPlayerSendCancel(cid, "You are already blessed!")
                return false
             end
          else
              doPlayerAddBlessing(cid, i)
              if i == maxbless then
                 if charges > 1 then
                    charges = charges-1
                 else
                     doRemoveItem(item.uid,1)
                 end
                 doItemSetAttribute(item.uid, "description",charge.. " bless times left")
                 return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been blessed!")
              end
          end
      end
return true
end
You only have to add the line in actions.xml and one other very important thing add a discription to the item saying "5 bless charges left" (the 5 has to be upfront)
 
Back
Top Bottom