<talkaction words="!exp" access="0" script="exp.lua"/>
function onSay(cid, words, param)
doPlayerSendTextMessage (cid, You need allot of experience points to advance!)
return TRUE
end
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
<talkaction words="!exp;!mana" event="script" value="kurwa.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
<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>
What should the scripts do? Tell you how much exp/mana you need to advance ?
http://otland.net/f132/exp-mana-talkaction-p-rep-64041/#post657901 <== link to my previous postExactly!
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
<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>
haha niceThen 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>