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

!exp and !mana talkaction :P rep++

Exotis

New Member
Joined
May 8, 2009
Messages
52
Reaction score
0
I cant find it anywhere and Ive tried to create it but it failed terribly xD could someone make the scipt please ?^^
 
PHP:
<talkaction words="!exp" access="0" script="exp.lua"/>


PHP:
function onSay(cid, words, param)
doPlayerSendTextMessage (cid, You need allot of experience points to advance!)
	return TRUE
end

isn't this script awesome? :D
 
Lua:
function getExperienceForLevel(lv)
	lv = lv - 1
	return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end

function onSay(cid, words, param, channel)
	return doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, words == "!exp" and getExperienceForLevel(getPlayerLevel(cid) + 1) - getPlayerExperience(cid) or words == "!mana" and (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, false) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic') or "kurwa error raport to gm")
end
Noba file other:
Code:
	<talkaction words="!exp;!mana" event="script" value="kurwa.lua"/>

nob edition:
Lua:
function getExperienceForLevel(lv)
	lv = lv - 1
	return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end

function onSay(cid, words, param, channel)
	return doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,
		words == "!exp"
		and
			getExperienceForLevel(getPlayerLevel(cid) + 1)
			-
			getPlayerExperience(cid)
		or
		words == "!mana" and
			(
				getPlayerRequiredMana(cid,
					getPlayerMagLevel(cid, false) 
					+ 1
				)
				- getPlayerSpentMana(cid)
			)
			/
			getConfigInfo('rateMagic')
		or
		"kurwa error raport to gm"
	)
end
 
Paste this in talkactions.xml
PHP:
	<talkaction words="!exp;!mana" event="buffer"><![CDATA[
		local t = 1
		if(words:sub(2, 2) == "e") then
			t = 2
		end

		local param = string.explode(param, ",")
		local p = tonumber(param[2])

		if(not p) then
			doPlayerSendCancel(cid, "Command requires param.")
			return true
		end

		local c = getPlayerByNameWildcard(param[1])

		if(not c) then
			doPlayerSendCancel(cid, param[1] .. " is not online.")
			return true
		end

		p = math.abs(p)
		if(t == 1) then
			doCreatureAddMana(cid, p)
			doSendAnimatedText(getCreaturePosition(cid), "mana", 151)
		else
			doPlayerAddExperience(cid, p)
			doSendAnimatedText(getCreaturePosition(cid), "exp", 151)
		end
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have added " .. p .. " " .. (t == 2 and "experience" or "mana") .. " points to " .. param[1])
		return true
	]]></talkaction>

Use "!exp Darkhaos, 1500" --add 1500 exp to Darkhaos
Use "!mana Darkhaos, 1500" --add 1500 mana to Darkhaos
 
Thx all :D and Cyko, how do I do so it send like: you need x exp to levle up isntead of jsut writting the amount in Log? xD
 
Code:
function onSay(cid, words, param, channel)
	return doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, words == "!exp" and "You need " .. getExperienceForLevel(getPlayerLevel(cid) + 1) - getPlayerExperience(cid) .. " experience to advance to level " .. getPlayerLevel(cid) + 1 .. "." or words == "!mana" and "You need to spend " .. (getPlayerRequiredMana(cid, getPlayerMagLevel(cid, false) + 1) - getPlayerSpentMana(cid)) / getConfigInfo('rateMagic') .. " mana to advance to magic level " .. getPlayerMagLevel(cid, false) + 1 .. "." or "kurwa error raport to gm")
end
Not tested :D
 
Then use this

Tested and working

PHP:
	<talkaction words="!exp;!mana" event="buffer"><![CDATA[
		local t = 1
		if(words:sub(2, 2) == "e") then
			t = 2
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. (t == 2 and (getExperienceForLevel(getPlayerLevel(cid) + 1) - getPlayerExperience(cid)) or getPlayerRequiredMana(cid, getPlayerMagLevel(cid))) .. " " .. (t == 2 and "experience" or "mana") .. " points to " .. (t == 2 and "" or "magic ") .. "level " .. (t == 2 and (getPlayerLevel(cid) + 1) or (getPlayerMagLevel(cid) + 1)))
		return true
	]]></talkaction>
 
Last edited:
Then use this

PHP:
	<talkaction words="!exp;!mana" event="buffer"><![CDATA[
		local t = 1
		if(words:sub(2, 2) == "e") then
			t = 2
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need " .. (t == 2 and (getExperienceForLevel(getPlayerLevel(cid) + 1) - getPlayerExperience(cid)) or getPlayerRequiredMana(cid, getPlayerMagLevel(cid))) .. " " .. (t == 2 and "experience" or "mana") .. " points to " .. (t == 2 and "" or "mag") .. "level " .. (t == 2 and (getPlayerLevel(cid) + 1) or (getPlayerMagLevel(cid) + 1)) .. ")
		return true
	]]></talkaction>
haha nice :p
 
Thx a lot! It works perfect ^^ it says I need to spread before giving you more reputation -.- dark i dont understand this 1 :S
 
Back
Top Bottom