• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Request] Bless price based on level

Didn't you already post in @Xikini's thread the same issue?
Calm down. :p
It's a 3 minute script, and there's about 20 billion (not even exaggerating) of them on the forum.
Code:
local bless = {1, 2, 3, 4, 5}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   
     for i = 1, table.maxn(bless) do
         if getPlayerBlessing(cid, bless[i]) then
             doPlayerSendCancel(cid, "You have all the blessings already.")
             return true
         end
     end
   
     if doPlayerRemoveMoney(cid, (getPlayerLevel(cid) * 10000)) == TRUE then
         for i = 1, table.maxn(bless) do
             doPlayerAddBlessing(cid, bless[i])
         end
         doCreatureSay(cid, "You have received every blessing.", TALKTYPE_ORANGE_1, cid)
         doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
     else
         doPlayerSendCancel(cid, "You require ".. getPlayerLevel(cid) * 10000 .." gold to receive blessings.")
     end
   
     return true
end
 
I see you learned something new in lua table.maxn, although # would have worked just as well, table.maxn is only really needed on dynamic content where the values of the table are unknown. :p
 
Thanks xikini :D works 100%

Can you made to buy aol too? :p just adding the price 10000 for the aol
Purchase aol the same way?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
     
     if doPlayerRemoveMoney(cid, (10000)) == TRUE then
         doPlayerAddItem(cid, 2173, 1, true)
         doCreatureSay(cid, "You have received an aol.", TALKTYPE_ORANGE_1, cid)
         doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
     else
         doPlayerSendCancel(cid, "You require 10000 gold to receive an aol.")
     end
     
     return true
end
 
Purchase aol the same way?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
   
     if doPlayerRemoveMoney(cid, (10000)) == TRUE then
         doPlayerAddItem(cid, 2173, 1, true)
         doCreatureSay(cid, "You have received an aol.", TALKTYPE_ORANGE_1, cid)
         doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
     else
         doPlayerSendCancel(cid, "You require 10000 gold to receive an aol.")
     end
   
     return true
end

NO, Purchase aol and bless in the same way, but the aol just cost 10000 and the bless 100gp each level
 
NO, Purchase aol and bless in the same way, but the aol just cost 10000 and the bless 100gp each level
Soo.. in order to buy blessings, they are forced to purchase an aol at the same time?.. Okay.
Code:
local bless = {1, 2, 3, 4, 5}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   
     for i = 1, table.maxn(bless) do
         if getPlayerBlessing(cid, bless[i]) then
             doPlayerSendCancel(cid, "You have all the blessings already.")
             return true
         end
     end
     
     if doPlayerRemoveMoney(cid, (getPlayerLevel(cid) * 100) + 10000) == TRUE then
         for i = 1, table.maxn(bless) do
             doPlayerAddBlessing(cid, bless[i])
         end
         doPlayerAddItem(cid, 2173, 1, true)
         doCreatureSay(cid, "You have received every blessing and an aol.", TALKTYPE_ORANGE_1, cid)
         doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
     else
         doPlayerSendCancel(cid, "You require ".. (getPlayerLevel(cid) * 100) + 10000 .." gold to receive blessings and an aol.")
     end
     
     return true
end
 
Back
Top