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

Action Blessings

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Solutions
2
Reaction score
115
The Forgotten Server 0.3.5
Tested & Working.

data/actions/actions.xml
PHP:
<action uniqueid="1000" event="script" value="blessings.lua"/>

data/actions/scripts/blessings.lua
Lua:
local cost = 50000
function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i = 1,5 do
	if (getPlayerBlessing(cid, i) == true) then
	    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	    doCreatureSay(cid, "You have already been blessed.", TALKTYPE_ORANGE_1)
	elseif (getPlayerMoney(cid) < cost) then
            doSendAnimatedText(getCreaturePosition(cid), "$$$", TEXTCOLOR_WHITE)
	    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need atleast ".. cost .." gold coins to be blessed.")
	else
            doPlayerRemoveMoney(cid, cost)
	    doPlayerAddBlessing(cid, i)
	    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
            doSendAnimatedText(getCreaturePosition(cid), "BLESSED!", TEXTCOLOR_RED)
	    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been blessed by all five of the gods.")
	end
	return true
    end
end
 
Last edited:
It'll take 50k for each bless, it'll send message You have been blessed by all five of the gods. 5x

Here's fix (Not tested :p):
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cost = 50000
	for i = 1, 5 do
		if (getPlayerBlessing(cid, i) == TRUE) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have been already blessed.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
			break
		end

		if (getPlayerMoney(cid) < cost) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You don't have enough gold coins.")
			break
		end

		doPlayerAddBlessing(cid, i)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been blessed.")
		doPlayerRemoveMoney(cid, math.floor(cost/5))
	end
	return true
end
 
Last edited:
You mean, another version?
Not fix :p
 
chojrak is right! xD

you have this:
Lua:
  elseif doPlayerRemoveMoney(cid, cost) == TRUE then
executed 5 times! so takes 250 k :).

and you don't have to write "== true" you can use:
Lua:
elseif doPlayerRemoveMoney(cid, cost) then

but Good Work ;)


EDIT: @Chojrak

Yours will take 50k each bless too! xD

should be doRemovePlayerMoney(cid,cost/5) ;)
 
chojrak is right! xD

you have this:
Lua:
  elseif doPlayerRemoveMoney(cid, cost) == TRUE then
executed 5 times! so takes 250 k :).

and you don't have to write "== true" you can use:
Lua:
elseif doPlayerRemoveMoney(cid, cost) then

but Good Work ;)

It doesn't take 250k.
It works.
 
Back
Top