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

Ceremonial Ankh

Godely

Member
Joined
Aug 19, 2007
Messages
233
Reaction score
19
Ceremonial_Ankh.gif

Ceremonial Ankh

Attributes: Shows your blessings
Notes: Shows which blessings you have received.

---

Can someone do that script for me? You "use" the Ceremonial Ankh, and you receive a "green message" showing which blessing you did receive.

Bless 1 = The Spiritual Shielding
Bless 2 = The Embrace of Tibia
Bless 3 = The Fire of the Suns
Bless 4 = The Wisdom of Solitude
Bless 5 = The Spark of the Phoenix

---

It would be something like this:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	bless1 = getPlayerBlessing(cid,1)
	bless2 = getPlayerBlessing(cid,2)
	bless3 = getPlayerBlessing(cid,3)
	bless4 = getPlayerBlessing(cid,4)
	bless5 = getPlayerBlessing(cid,5)

	if bless1 or bless2 or bless3 or bless4 or bless5 then
		doPlayerSendTextMessage(cid,22," ??? ")
	end
end

PS.: The message would be like "You have these blessings: ' .. X .. ', ' .. Y ..'."

Thanks ;)
 
Last edited:
PHP:
--global.lua
function concat(t, f1, f2)
	local str
	local i=1
	local maxv = table.maxv(t) 
	for _, v in pairs(t) do
		if i > 1 then
			if i == maxv then
				str = str..f2..v
			else
				str = str..f1..v
			end
		else
			str = v
		end
		i=i+1
	end
	return str
end

function table.maxv(t)
	local i=0
	for _ in pairs(t) do i=i+1 end
	return i
end

do
	local blessingNames = {
		"The Spiritual Shielding",
		"The Embrace of Tibia",
		"The Fire of the Suns",
		"The Wisdom of Solitude",
		"The Spark of the Phoenix"
	}
	function getBlessingName(bless)
		return blessingNames[bless] or -1
	end
end

-- the script
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local playerBlessings = {}
	for i=1, 5 do
		if getPlayerBlessing(cid, i) then
			table.insert(playerBlessings, getBlessingName(i))
		end
	end

	local message = "You have no blessings."
	if #playerBlessings > 0 then
		message = "You have the following blessings: " .. concat(playerBlessings, ", ", " and ") .. "."
	end
	doPlayerSendTextMessage(cid, 22, message)
	return TRUE
end
 
Last edited:
Back
Top