ares413
New Member
- Joined
- Apr 1, 2010
- Messages
- 130
- Reaction score
- 3
i have a script, sorta like a capturing a pet system, but im trying to change into where you right click the fish bowl, and it creates a monster that attacks everyone, NOT a summoned creature. currently everything in the script works 100% except that part, heres my script:
please help rep++
Code:
local storage = 56487
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 not isCreature(itemEx.uid) then
if getCreatureStorage(cid, storageLol) < os.time() then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonMonster(cid, string.sub(desc, a + 2, b - 1))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
elseif x ~= nil then
if #getCreatureSummons(cid) == 0 then
doSummonCreature(cid, string.sub(desc, x + 2, y - 1))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You summoned a monster.')
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You\'ve already summoned a monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendCancel(cid, 'You need to wait before summoning it again.')
end
elseif itemEx.uid == cid then
if #getCreatureSummons(cid) > 0 then
if string.find(desc:lower(), 'catched monster:') ~= nil then
local x, y = string.find(desc, ': %a+.')
local a, b = string.find(desc, ': %a+ %a+.')
if a ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, a + 2, b - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
elseif x ~= nil then
for k, v in pairs(getCreatureSummons(cid)) do
if getCreatureName(v):lower() == string.sub(desc, x + 2, y - 1) then
doRemoveCreature(v)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your monster is back to the bottle.')
break
end
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Unknown monster.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t catch anything into the bottle.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You didn\'t summon anything.')
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You can summon a catched monster if you use it on a tile or on ur self if you want to summon it back to the bottle.')
end
return true
end
please help rep++