function explode(pos)
local area = {
{0, 0, 1, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1},
{1, 1, 1, 3, 1, 1, 1},
{1, 1, 1, 1, 1, 1, 1},
{0, 1, 1, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0}
}
area = createCombatArea(area)
for i = 1, 3 do
addEvent(doSendAnimatedText, 1000*i, pos, "" .. (i > 2 and 3 or i < 2 and 1 or i) .. "", 180)
end
doAreaCombatHealth(0, COMBAT_FIREAREA, pos, area, -config.min, -config.max, CONST_ME_FIREAREA)
return true
end
local config = {
item = {
create = {enable = true, itemCreated = xxxx},
transport = false
}, -- if not enable remove then it will transport the SAME ITEM, else it will create a NEW ONE. (it will always remove the item).
storage = 5555, -- free storage
seconds = 10, -- seconds of exhaustion
min = 500, -- min dmg of bomb
max = 1000 -- max dmg of bomb
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if exhaustion.get(cid, storage) then
return doPlayerSendCancel(cid, "You can not use this item yet.")
end
if(config.item.create.enable and config.item.transport) or (not config.item.create.enable and not config.item.transport) then
print("Item creation and transport in config is wrong - bomb script")
return doPlayerSendCancel(cid, "Problem! Please contact an administrator")
end
doCreateItem(config.item.create.enable and config.item.create.itemCreated or item.uid, 1, getPlayerPosition(cid))
doRemoveItem(item.uid, 1)
exhaustion.set(cid, config.storage, 1000*config.seconds)
for i = 5000, 5002 do
setPlayerStorageValue(cid, i, getPlayerPosition(cid).i == 5000 and x or i == 5001 and y or z)
end
local pos = {x=getPlayerStorageValue(cid, 5000), y=getPlayerStorageValue(cid,5001), z=getPlayerStorageValue(cid,5002)}
explode(pos)
return true
end