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

Search a Script

Status
Not open for further replies.

Spankarn

New Member
Joined
Jul 1, 2010
Messages
101
Reaction score
1
Hiho!
Search a script for doing !spells then the spell list come up..

Please put the script here and where i should put it !:)
thanks!:D
 
Soo...
Go to otsdirectory/data/talkactions/talkactions.xml
and put there this line:
Code:
<talkaction words="!spells;/spells" event="script" value="spells.lua"/>
save and close.

Now go to data/talkactions/scripts
make a new .lua file. Name it spells.lua and paste there this:
Code:
function onSay(cid, words, param, channel)
	local t = {}
	for i = 0, getPlayerInstantSpellCount(cid) - 1 do
		local spell = getPlayerInstantSpellInfo(cid, i)
		if(spell.level ~= 0) then
			if(spell.manapercent > 0) then
				spell.mana = spell.manapercent .. "%"
			end

			table.insert(t, spell)
		end
	end

	table.sort(t, function(a, b) return a.level < b.level end)
	local text, prevLevel = "", -1
	for i, spell in ipairs(t) do
		local line = ""
		if(prevLevel ~= spell.level) then
			if(i ~= 1) then
				line = "\n"
			end

			line = line .. "Spells for Level " .. spell.level .. "\n"
			prevLevel = spell.level
		end

		text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
	end

	doShowTextDialog(cid, 2195, text)
	return true
end
Save and close.
Done
 
Soo...
Go to otsdirectory/data/talkactions/talkactions.xml
and put there this line:
Code:
<talkaction words="!spells;/spells" event="script" value="spells.lua"/>

Now go to data/talkactions/scripts
make a new .lua file. Name it spells.lua and paste there this:
Code:
function onSay(cid, words, param, channel)
	local t = {}
	for i = 0, getPlayerInstantSpellCount(cid) - 1 do
		local spell = getPlayerInstantSpellInfo(cid, i)
		if(spell.level ~= 0) then
			if(spell.manapercent > 0) then
				spell.mana = spell.manapercent .. "%"
			end

			table.insert(t, spell)
		end
	end

	table.sort(t, function(a, b) return a.level < b.level end)
	local text, prevLevel = "", -1
	for i, spell in ipairs(t) do
		local line = ""
		if(prevLevel ~= spell.level) then
			if(i ~= 1) then
				line = "\n"
			end

			line = line .. "Spells for Level " .. spell.level .. "\n"
			prevLevel = spell.level
		end

		text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
	end

	doShowTextDialog(cid, 2195, text)
	return true
end
Save and close.
Done

Thank you so much!
Rep++
 
Status
Not open for further replies.
Back
Top