É, de fato, não pensei nisso.
function onSay(cid, words, param, channel)
param = param:match('%"(%a+)') or param:lower() or ""
local vocations = {"Druid", "Elder Druid"}
local monster
if param == "" then
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
monster = getMonsterInfo(param)
if monster == nil or (monster.summonable == false and getPlayerFlagValue(cid, PLAYERFLAG_CANSUMMONALL) == false)then
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
if not isInArray(vocations, getPlayerVocationName(cid)) and getPlayerFlagValue(cid, PLAYERFLAG_IGNORESPELLCHECK) == false then
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOURVOCATIONCANNOTUSETHISSPELL)
return true
end
if (#getCreatureSummons(cid) >= getConfigValue("maxPlayerSummons") and getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) == false) or getCreatureStorage(cid, 4132) == 1 then
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
if getCreatureMana(cid) < monster.manaCost and getPlayerFlagValue(cid, PLAYERFLAG_HASINFINITEMANA) == false then
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
return true
end
doSummonMonster(cid, param)
if getPlayerFlagValue(cid, PLAYERFLAG_HASINFINITEMANA) == false then
doCreatureAddMana(cid, -monster.manaCost)
end
doSendMagicEffect(getThingPosition(cid), CONST_ME_MAGIC_BLUE)
doCreatureSay(cid, "utevo res \"".. param .."\"")
return true
end