Primeiro, va para actions / scripts e crie um arquivo chamado mina.lua e adhicionar o seguinte:
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function getTime(s)
local n = math.floor(s / 60)
s = s - (60 * n)
return n, s
end
local items = {
[2554] = {
storagetime = 6423356224333,
time = 13,
aid = 4444
}
}
local bombstorage = 3847757422
function onUse(cid, item, fromPosition, itemEx, toPosition) -- Script by Xafterin
local m = items[item.itemid]
if m then
if not isWalkable(toPosition, false, false, false) then
return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You cannot throw the ".. getItemNameById(item.itemid) .." here!.")
end
if getTilePzInfo(getCreaturePosition(cid)) or getTilePzInfo(toPosition) then
return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"You cannot use this weapon in a protection zone!.")
end
local time = m.time
if os.time()-getPlayerStorageValue(cid, m.storagetime)+1 <= time then
minutes,seconds = getTime(time-(os.time()-getPlayerStorageValue(cid, m.storagetime)))
return doPlayerSendTextMessage(cid, 27, "Wait "..seconds.." seconds.")
end
doItemSetAttribute(itemEx.uid, "aid", m.aid)
doItemSetAttribute(itemEx.uid, "description", getPlayerName(cid))
setPlayerStorageValue(cid, m.storagetime, os.time())
doPlayerAddSkillTry(cid, 5, 1)
end
return true
end
Va para actions.xml
<action itemid="2554" event="script" value="mina.lua" allowfaruse="1"/>
Movement:
local mina = {
[4444] = {delay = 1, -- seconds
mindamage = -14434,
maxdamage = -304343,
damagetype = COMBAT_FIREDAMAGE}
}
function onStepIn(cid, item, position, fromPosition)
local m = mina[item.actionid]
local function boom(cid, min, max, damagetype, pos)
-- COMBAT FUNCTION --
local area = {
{x = pos.x+1, y = pos.y, z = pos.z},
{x = pos.x, y = pos.y+1, z = pos.z},
{x = pos.x-1, y = pos.y, z = pos.z},
{x = pos.x+1, y = pos.y+1, z = pos.z},
{x = pos.x-1, y = pos.y-1, z = pos.z},
{x = pos.x, y = pos.y-1, z = pos.z},
{x = pos.x+1, y = pos.y-1, z = pos.z},
{x = pos.x-1, y = pos.y+1, z = pos.z},
{x = pos.x, y = pos.y, z = pos.z}
}
for i = 1,#area do
doAreaCombatHealth(0, damagetype, area[i], 0, min, max, 0)
end
return true
end
if getPlayerName(cid) == getItemAttribute(item.uid, "description") then
return doPlayerSendCancel(cid, "This is your bomb.")
end
addEvent(boom, m.delay * 1000, cid, m.min, m.max, m.damagetype, position)
doItemEraseAttribute(item.uid, "aid")
return true
end
movements.xml
<movevent type="StepIn" actionid="4444" event="script" value="mina.lua"/>