local monsters = {
{name = "Pirate Buccaneer", pos = {x = 847, y = 1141, z = 6}},
{name = "Pirate Buccaneer", pos = {x = 848, y = 1141, z = 6}},
{name = "Pirate Buccaneer", pos = {x = 849, y = 1141, z = 6}},
{name = "Pirate Corsair", pos = {x = 847, y = 1142, z = 6}},
{name = "Pirate Corsair", pos = {x = 848, y = 1142, z = 6}},
{name = "Pirate Corsair", pos = {x = 849, y = 1142, z = 6}},
{name = "Pirate Corsair", pos = {x = 850, y = 1142, z = 6}},
{name = "Pirate Corsair", pos = {x = 851, y = 1142, z = 6}},
{name = "Pirate Cutthroat", pos = {x = 847, y = 1143, z = 6}},
{name = "Pirate Cutthroat", pos = {x = 848, y = 1143, z = 6}},
{name = "Pirate Marauder", pos = {x = 847, y = 1144, z = 6}},
{name = "Pirate Marauder", pos = {x = 848, y = 1144, z = 6}},
{name = "Pirate Marauder", pos = {x = 849, y = 1144, z = 6}},
{name = "Pirate Marauder", pos = {x = 850, y = 1144, z = 6}}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local function doTransformBack(pos, itemid, transformid)
return doTransformItem(getTileItemById(pos, transformid).uid, itemid)
end
if itemEx.itemid == 5675 and item.uid == 5569 then
if getPlayerStorageValue(cid, 7008) == -1 then
local rand = math.random(1, 2)
if rand == 1 then
doSendMagicEffect(toPosition,CONST_ME_FIREAREA)
doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -100, -100, CONST_ME_NONE)
doCreatureSay(cid, "KABOOM!", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, 2255)
addEvent(doTransformBack, 42*60*1000, toPosition, itemEx.itemid, 2255)
broadcastMessage("Boys! To arms!!!", MESSAGE_EVENT_ADVANCE)
local spec = getSpectators({x = 849, y = 1143, z = 6}, 5, 5, FALSE)
if spec ~= nil then
for _, s in pairs(spec) do
n = getCreatureName(s)
if n == "Pirate Buccaneer" or n == "Pirate Corsair" or n == "Pirate Cutthroat" or n == "Pirate Marauder" then
doPlayerSendCancel(cid, "The raid is still there.")
return TRUE
end
end
for m = 1, #monsters do
doSummonCreature(monsters[m].name, monsters[m].pos)
end
broadcastMessage("Pirate raid started.")
end
else
doSendMagicEffect(toPosition,CONST_ME_FIREAREA)
doTargetCombatHealth(0, cid, COMBAT_FIREDAMAGE, -100, -100, CONST_ME_NONE)
doCreatureSay(cid, "KABOOM!", TALKTYPE_ORANGE_1)
doTransformItem(itemEx.uid, 2255)
addEvent(doTransformBack, 28*60*1000, toPosition, itemEx.itemid, 2255)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You allready found XXX his treasure.")
end
end
return TRUE
end