Im using this script, its fine but when trying to use it to catch a monster it doesnt work, im guessing it suppose to have the option "use with" but only says "use"
local t = {
percent = 40,
monsters = {
['Triton'] = 100,
['sea serpent'] = 75,
['quara constrictor'] = 70,
['quara hydromancer'] = 60,
['quara mantassin'] = 40,
['quara pincher'] = 40,
['quara predator'] = 20,
['massive water elemental'] = 10,
},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if isMonster(itemEx.uid) then
if t.monsters[getCreatureName(itemEx.uid):lower()] then
if getCreatureHealth(itemEx.uid) <= getCreatureMaxHealth(itemEx.uid) * t.percent / 100 then
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if string.find(desc:lower(), 'catched monster:') == nil then
if math.random(1, 100) < t.monsters[getCreatureName(itemEx.uid):lower()] then
doSendMagicEffect(toPosition, CONST_ME_YALAHARIGHOST)
local newItem = doPlayerAddItem(cid, 8764, 1)
doItemSetAttribute(newItem, 'description', desc .. ' Catched monster: ' .. getCreatureName(itemEx.uid):lower() .. '. ' .. getCreatureName(cid) .. ' has catched this monster.')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You successfuly catched ' .. getCreatureName(itemEx.uid):lower() .. ' into the fish bowl.')
doRemoveCreature(itemEx.uid)
else
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You failed at capturing monster.')
doRemoveCreature(itemEx.uid)
end
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can\'t catch two monsters into same bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Creature do not have require low health.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on specific monsters.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on monsters.')
end
return true
end
local t = {
percent = 40,
monsters = {
['Triton'] = 100,
['sea serpent'] = 75,
['quara constrictor'] = 70,
['quara hydromancer'] = 60,
['quara mantassin'] = 40,
['quara pincher'] = 40,
['quara predator'] = 20,
['massive water elemental'] = 10,
},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if isMonster(itemEx.uid) then
if t.monsters[getCreatureName(itemEx.uid):lower()] then
if getCreatureHealth(itemEx.uid) <= getCreatureMaxHealth(itemEx.uid) * t.percent / 100 then
local desc = getItemAttribute(item.uid, 'description') == nil and getItemInfo(item.itemid).description or getItemAttribute(item.uid, 'description')
if string.find(desc:lower(), 'catched monster:') == nil then
if math.random(1, 100) < t.monsters[getCreatureName(itemEx.uid):lower()] then
doSendMagicEffect(toPosition, CONST_ME_YALAHARIGHOST)
local newItem = doPlayerAddItem(cid, 8764, 1)
doItemSetAttribute(newItem, 'description', desc .. ' Catched monster: ' .. getCreatureName(itemEx.uid):lower() .. '. ' .. getCreatureName(cid) .. ' has catched this monster.')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You successfuly catched ' .. getCreatureName(itemEx.uid):lower() .. ' into the fish bowl.')
doRemoveCreature(itemEx.uid)
else
doSendMagicEffect(toPosition, CONST_ME_GROUNDSHAKER)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You failed at capturing monster.')
doRemoveCreature(itemEx.uid)
end
doRemoveItem(item.uid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can\'t catch two monsters into same bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Creature do not have require low health.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on specific monsters.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can use it only on monsters.')
end
return true
end