local cost = 20000
function onUse(cid, item, fromPosition, itemEx, toPosition)
local m = 0
for i = 1, 5 do
if getPlayerBlessing(cid, i) then
m = m+1
end
end
if m == 5 then
doPlayerSendCancel(cid, "You are already blessed.")
return 1
end
if(getPlayerMoney(cid) < cost*5) then
doPlayerSendCancel(cid, "You do not have enough money.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return 1
end
for i = 1, 5 do
if not(getPlayerBlessing(cid, i)) then
doPlayerAddBlessing(cid, i)
end
end
doPlayerRemoveMoney(cid, cost*5)
doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received all of the blessings!")
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
else
doTransformItem(item.uid, 1945)
end
return true
end
<action uniqueid="5050" script="blessings.lua" />
<talkaction words="!bless" event="script" value="bless.lua"/>
function onSay(cid, words, param)
if getPlayerBlessing(cid, 1) or getPlayerBlessing(cid, 2) or getPlayerBlessing(cid, 3) or getPlayerBlessing(cid, 4) or getPlayerBlessing(cid, 5) then
doPlayerSendCancel(cid,'You have already got one or more blessings!')
else
if doPlayerRemoveMoney(cid, 50000) == TRUE then
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'You have been blessed by the gods!')
else
doPlayerSendCancel(cid, "You need 5 crystal coin to get blessed!")
end
end
return 1
end
-- Blessings
blessingOnlyPremium = true
blessingReductionBase = 30
blessingReductionDecreament = 5
eachBlessReduction = 10
<talkaction words="!blessings" script="blessings.lua" />
function onSay(cid, words, param, channel)
if getPlayerBlessing(cid, 5) == FALSE then
if getPlayerMoney(cid) >= 50000 then
for i = 1,5 do
doPlayerAddBlessing(cid, i)
end
doSendMagicEffect(getCreaturePosition(cid), 39)
doPlayerRemoveMoney(cid, 50000)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
doPlayerSendTextMessage(cid, 22, "You have been blessed by the gods!")
else
doPlayerSendCancel(cid, "Sorry, but you dont have 5cc")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
else
doPlayerSendCancel(cid, "You have already been blessed.")
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
end
return true
end
function onSay(cid, words, param)
local fail = 0
if getPlayerLevel(cid) < 31 then
cost = 2000
else
cost = ((getPlayerLevel(cid) - 30) * 200) + 2000
end
if cost > 20000 then
cost = 20000
end
for i = 1, 5 do
if getPlayerBlessing(cid, i) then
fail = fail + 1
else
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddBlessing(cid, i)
if i == 5 and not(fail == 5) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HOLYDAMAGE)
end
else
doPlayerSendCancel(cid, "You do not have enough money to buy all the blessings!")
break
end
end
end
if fail == 5 then
doPlayerSendCancel(cid, "You already have all the blessings!")
end
return TRUE
end