function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to type target name.")
return true
end
if(getPlayerLevel(cid) < 100) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need atleast 100 experience level to cast this spell.")
return true
end
if(getCreatureMana(cid) < getCreatureMaxMana(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don't have enough mana points to cast this spell.")
return true
end
if(exhaustion.get(cid, 1337)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are exhausted.")
return true
end
local player = getPlayerByName(param)
if(player) then
if(player == cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Ey, don't cheat! :P")
return true
end
if(getTileInfo(getCreaturePosition(cid)).protection) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't cast this spell while you're in protection zone.")
return true
end
if(getCreatureMana(player) < getCreatureMaxMana(player) / 2) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your target needs atleast 50% of his/her mana points.")
return true
end
local dest = getCreaturePosition(player)
if(getTileInfo(dest).protection) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't cast this spell while target is in protection zone.")
elseif(getTileInfo(dest).nologout) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't cast this spell while target is on no logout tile.")
elseif(getTileInfo(dest).house) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't cast this spell while target is inside house.")
else
doTeleportThing(cid, dest)
doSendAnimatedText(dest, "Caught!", TEXTCOLOR_BLUE)
exhaustion.set(cid, 1337, 30 * 60)
doCreatureAddMana(cid, -getCreatureMana(cid))
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with that name is not online.")
end
return true
end