• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Bomb in PZ

piraton

New Member
Joined
Jun 3, 2009
Messages
22
Reaction score
0
Hi! I have this script for bomb (granade)
Code:
local area = createCombatArea{
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
function onUse(cid, item, frompos, itemEx, toPosition)
local configs = {
sec = 5, -- segundos para explodir
typex = COMBAT_FIREDAMAGE, -- tipo da explosão
min = 100, -- dano minimo da explosão
max = 1000, -- dano maximo da explosão
ef = 6, -- efeito da explosão
item = 2501, -- item ki vai criar no chão
level = 10, -- level para usar o item
}
if getPlayerLevel(cid) >= configs.level then
doCreateItem(configs.item, toPosition)
for i = 1, configs.sec do
local x = configs.sec - i
local n = math.random(256)
if i == 1 and x ~= 0 then
doSendAnimatedText(toPosition, x .. " sec", n)
elseif i <= configs.sec and i ~= 1 and x ~= 0 then
addEvent(doSendAnimatedText, i*1000, toPosition, x .. " sec", n)
end
end
addEvent(doCleanTile, 1000*configs.sec, toPosition, false)
addEvent(doAreaCombatHealth, 1000*configs.sec, cid, configs.typex, toPosition, area, -configs.min, -configs.max, configs.ef)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You need level ".. configs.level .." to use this item.")
end
return true
end

But can use from Protection Zone... can anyone help? please? (:
[Sorry for bad english :c]
 
Code:
local area = createCombatArea{
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
function onUse(cid, item, frompos, itemEx, toPosition)
if (getTilePzInfo(getCreaturePosition(cid)) == 1) then
return 0
end
local configs = {
sec = 5, -- segundos para explodir
typex = COMBAT_FIREDAMAGE, -- tipo da explosão
min = 100, -- dano minimo da explosão
max = 1000, -- dano maximo da explosão
ef = 6, -- efeito da explosão
item = 2501, -- item ki vai criar no chão
level = 10, -- level para usar o item
}
if getPlayerLevel(cid) >= configs.level then
doCreateItem(configs.item, toPosition)
for i = 1, configs.sec do
local x = configs.sec - i
local n = math.random(256)
if i == 1 and x ~= 0 then
doSendAnimatedText(toPosition, x .. " sec", n)
elseif i <= configs.sec and i ~= 1 and x ~= 0 then
addEvent(doSendAnimatedText, i*1000, toPosition, x .. " sec", n)
end
end
addEvent(doCleanTile, 1000*configs.sec, toPosition, false)
addEvent(doAreaCombatHealth, 1000*configs.sec, cid, configs.typex, toPosition, area, -configs.min, -configs.max, configs.ef)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You need level ".. configs.level .." to use this item.")
end
return true
end
 
try this
LUA:
local area = createCombatArea{
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
function onUse(cid, item, frompos, itemEx, toPosition)
local configs = {
sec = 5, -- segundos para explodir
typex = COMBAT_FIREDAMAGE, -- tipo da explosão
min = 100, -- dano minimo da explosão
max = 1000, -- dano maximo da explosão
ef = 6, -- efeito da explosão
item = 2501, -- item ki vai criar no chão
level = 10, -- level para usar o item
}
if getPlayerLevel(cid) >= configs.level then
doCreateItem(configs.item, toPosition)
for i = 1, configs.sec do
local x = configs.sec - i
local n = math.random(256)
if i == 1 and x ~= 0 then
doSendAnimatedText(toPosition, x .. " sec", n)
elseif i <= configs.sec and i ~= 1 and x ~= 0 then
addEvent(doSendAnimatedText, i*1000, toPosition, x .. " sec", n)
end
end
addEvent(doCleanTile, 1000*configs.sec, toPosition, false)
addEvent(doAreaCombatHealth, 1000*configs.sec, cid, configs.typex, toPosition, area, -configs.min, -configs.max, configs.ef)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You need level ".. configs.level .." to use this item.")
end
if getTilePzInfo(toPosition) == true then
return doPlayerSendCancel(cid, "You cannot use this in a PZ!.")
end
return true
end
 
@Up
Fix your script and works perfectly (:
Code:
local area = createCombatArea{
{0, 1, 1, 1, 0},
{1, 1, 1, 1, 1},
{1, 1, 3, 1, 1},
{1, 1, 1, 1, 1},
{0, 1, 1, 1, 0}
}
function onUse(cid, item, frompos, itemEx, toPosition)
local configs = {
sec = 5, -- segundos para explodir
typex = COMBAT_FIREDAMAGE, -- tipo da explosão
min = 100, -- dano minimo da explosão
max = 1000, -- dano maximo da explosão
ef = 6, -- efeito da explosão
item = 2501, -- item ki vai criar no chão
level = 10, -- level para usar o item
}
if getPlayerLevel(cid) >= configs.level then
if getTilePzInfo(toPosition) == true then
return doPlayerSendCancel(cid, "You cannot use this in a PZ!.")
end
doCreateItem(configs.item, toPosition)
for i = 1, configs.sec do
local x = configs.sec - i
local n = math.random(256)
if i == 1 and x ~= 0 then
doSendAnimatedText(toPosition, x .. " sec", n)
elseif i <= configs.sec and i ~= 1 and x ~= 0 then
addEvent(doSendAnimatedText, i*1000, toPosition, x .. " sec", n)
end
end
addEvent(doCleanTile, 1000*configs.sec, toPosition, false)
addEvent(doAreaCombatHealth, 1000*configs.sec, cid, configs.typex, toPosition, area, -configs.min, -configs.max, configs.ef)
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "You need level ".. configs.level .." to use this item.")
end
return true
end

Thank you very much n.n
 
Last edited:
Back
Top