local config = {
monsters = {
['Demon'] = {}
}
}
function onCastSpell(cid, var)
local container = doPlayerAddItem(cid, 2272)-- change to right itemid
if getCreatureMaster(getTopCreature(var.pos).uid) == cid then
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
return true
end
if not(getCreatureMaster(getTopCreature(var.pos).uid) == getTopCreature(var.pos).uid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can't do this to summons.")
return false
end
if isMonster(getTopCreature(var.pos).uid) then
if config.monsters[getCreatureName(getTopCreature(var.pos).uid)] then
if math.random(10) == 1 then
doItemSetAttribute(container, "description", "It contains a captured " .. getCreatureName(getTopCreature(var.pos).uid) .. ".")
doRemoveCreature(getTopCreature(var.pos).uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry didn't work.") -- remove if you want
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry can't use with this animal.") -- remove if you want
return false
end
end
return true
end