aki não deu nada ;(aparece
"You can not use this object."
q q eu faço??
aki não deu nada ;(aparece
"You can not use this object."
q q eu faço??
info
Grupo: Campones
Registrado: 13/12/07
Posts: 56
Reputação: 0
Char no Tibia: Filho Do Stun of Pacera

putz gente
da um help ae
a função do mayNotMove(cid,1) soh funfa nesse 2 serers..
num tem como eu colocar essas funções no meu?
nem pelo global.lua?
gostei mtu da ideia
fiz td
fiko legal
mais a bomba naum explode por causa dessa função..
se eu tirar ela sera q explode?
Muito rox para fazer traps.
Vlw ai pelo post cara ta de parabens.
PLASTIC BOMB BY COLEX
Como funciona?
O player faz use em uma Plastic Bomb (eu uso o item 4825), e ficará imóvel um certo tempo (default é 5 segundos) instalando a bomba, depois de a bomba estar instalada o player poderá mover-se e a bomba irá demorar um certo tempo para explodir (default 5 segundos). A explosão será causada numa área 3x3 em que o player que estiver no centro da explosão levará sempre os danos mais elevados possiveis e os outros players que estiverem à volta será aleatório entre os danos maiores e menores (os danos são definidos no inicio do script em MAX_HIT e MIN_HIT).
1º Passo: na pasta data/actions/scripts crie um novo arquivo com o nome bomb.lua e insira o seguinte texto dentro dele:
----------Plastic Bomb by Colex----------- local PLANTING_DELAY = 5 --seconds local EXPLOSION_DELAY = 5000 --milliseconds local MAX_HIT = 500 local MIN_HIT = 100 local PVP = true -- true for PVP, false for Non-PVP local PLAYERS = {} function isInArray(table, valor) for i,j in pairs(table) do if (j == valor) then return i end end return 0 end function explosion(info) area = { {0,0,0,0,0}, {0,1,1,1,0}, {0,1,1,1,0}, {0,1,1,1,0}, {0,0,0,0,0}, } hitpos = {x=info.pos.x, y=info.pos.y, z=info.pos.z, stackpos=253} center = {} center.y = math.floor(table.getn(area)/2)+1 for i in ipairs(area) do center.x = math.floor(table.getn(area[i])/2)+1 for j, v in ipairs(area[i]) do if (v == 1) then hitpos.x = info.pos.x + (j - center.x) hitpos.y = info.pos.y + (i - center.y) if (getTilePzInfo(hitpos) == 0) then victim = getThingfromPos(hitpos) effect = 4 if ((j == center.x) and (i == center.y)) then doSendAnimatedText(hitpos,"KABOOOOOM",TEXTCOLOR_RED) hitpoints = MAX_HIT effect = 5 else hitpoints = math.random(MIN_HIT,MAX_HIT) end if (isPlayer(victim.uid) == 1) then if (PVP == true) then doPlayerSendTextMessage(victim.uid,20,"You have lost "..hitpoints.." hitpoints by "..getPlayerName(info.player).."'s plastic bomb") else hitpoints = 0 end end if (isCreature(victim.uid) == 1) then doPlayerAddHealth(victim.uid,-hitpoints) end doSendMagicEffect(hitpos,effect) end end end end PLAYERS[isInArray(PLAYERS, info.player)] = 0 mayNotLogout(info.player, 0) return 1 end function planting(info) if info.num == PLANTING_DELAY then doPlayerSendTextMessage(info.player,22,"Plastic Bomb successfully planted!") mayNotMove(info.player,0) addEvent(explosion,EXPLOSION_DELAY,info) else info.num = info.num + 1 doPlayerSendTextMessage(info.player,22,info.num.."...") addEvent(planting,1000,info) end return 1 end function onUse(cid, item, frompos, item2, topos) position = getThingPos(item.uid) if (getTilePzInfo(position) == 0) then if (isInArray(PLAYERS, cid) == 0) then table.insert(PLAYERS, cid) doSendMagicEffect(frompos,3) info = {player = cid, pos = position, num = 1} doPlayerSendTextMessage(cid,22,"Planting the bomb...") doPlayerSendTextMessage(cid,22,"1...") mayNotMove(cid,1) mayNotLogout(cid, 1) doRemoveItem(item.uid,1) addEvent(planting,1000,info) else doPlayerSendCancel(cid,"You can only plant one bomb at the same time.") end else doPlayerSendCancel(cid,"You can not plant this bomb in a PZ!") end return 1 end
2º Passo: abra a pasta data/actions e adicione a seguinte linha dentro do arquivo actions.xml:
<action itemid="4852" script="bomb.lua" />
Pronto! Sua plastic bomb deve estar funcional...
Alguma dúvida? poste e eu tentarei ajuda-lo!
(Esta action foi apenas testado em um server 8.0)
Colex
Assim .. fiz tudo certinho, mas ae q rola a duvida...
11:39 /i 4852
11:39 Planting the bomb...
11:39 1...
11:39 You see a black stone. ID: 4852.
eu crio o item e qdo vc da use nele.. ele aprece essa mensagem ae e nao faz nada ...
oq poderia ser.. vresão 8.1.
marleide,
provavelmente vc n utiliza um ot com capacidade mayNot...
tem uma forma de c arrumar isso...porém vc tera de deixar para traz a parte do script "anti" log out e move
ou seja, o player podera se mover enquanto implanta e poderá logar tb
ficando assim:
local PLANTING_DELAY = 5 --seconds
local EXPLOSION_DELAY = 5000 --milliseconds
local MAX_HIT = 500
local MIN_HIT = 100
local PVP = true -- true for PVP, false for Non-PVP
local PLAYERS = {}
function isInArray(table, valor)
for i,j in pairs(table) do
if (j == valor) then
return i
end
end
return 0
end
function explosion(info)
area = {
{0,0,0,0,0},
{0,1,1,1,0},
{0,1,1,1,0},
{0,1,1,1,0},
{0,0,0,0,0},
}
hitpos = {x=info.pos.x, y=info.pos.y, z=info.pos.z, stackpos=253}
center = {}
center.y = math.floor(table.getn(area)/2)+1
for i in ipairs(area) do
center.x = math.floor(table.getn(area[i])/2)+1
for j, v in ipairs(area[i]) do
if (v == 1) then
hitpos.x = info.pos.x + (j - center.x)
hitpos.y = info.pos.y + (i - center.y)
if (getTilePzInfo(hitpos) == 0) then
victim = getThingfromPos(hitpos)
effect = 4
if ((j == center.x) and (i == center.y)) then
doSendAnimatedText(hitpos,"KABOOOOOM",TEXTCOLOR_RED)
hitpoints = MAX_HIT
effect = 5
else
hitpoints = math.random(MIN_HIT,MAX_HIT)
end
if (isPlayer(victim.uid) == 1) then
if (PVP == true) then
doPlayerSendTextMessage(victim.uid,20,"You have lost "..hitpoints.." hitpoints by "..getPlayerName(info.player).."'s plastic bomb")
else
hitpoints = 0
end
end
if (isCreature(victim.uid) == 1) then
doPlayerAddHealth(victim.uid,-hitpoints)
end
doSendMagicEffect(hitpos,effect)
end
end
end
end
PLAYERS[isInArray(PLAYERS, info.player)] = 0
return 1
end
function planting(info)
if info.num == PLANTING_DELAY then
doPlayerSendTextMessage(info.player,22,"Plastic Bomb successfully planted!")
addEvent(explosion,EXPLOSION_DELAY,info)
else
info.num = info.num + 1
doPlayerSendTextMessage(info.player,22,info.num.."...")
addEvent(planting,1000,info)
end
return 1
end
function onUse(cid, item, frompos, item2, topos)
position = getThingPos(item.uid)
if (getTilePzInfo(position) == 0) then
if (isInArray(PLAYERS, cid) == 0) then
table.insert(PLAYERS, cid)
doSendMagicEffect(frompos,3)
info = {player = cid, pos = position, num = 1}
doPlayerSendTextMessage(cid,22,"Planting the bomb...")
doPlayerSendTextMessage(cid,22,"1...")
doRemoveItem(item.uid,1)
addEvent(planting,1000,info)
end
else
doPlayerSendCancel(cid,"You can not plant this bomb in a PZ!")
end
return 1
end
não testei
espero ter ajudado
EDIT: Aproveitando o belo tópico revivido,
tenho uma dúvida:
fui tentar fazer uma segunda bomb mais forte e talz porém não consegui,
parece que elas meio que "se misturão" e prevalece a segunda(a mais forte)
a primeira fica bugada e não funciona direito
se alguém souber eu agradeço
Abraços
Editado Março 19 por FlameGM
info
Grupo: Campones
Registrado: 13/12/07
Posts: 56
Reputação: 0
Char no Tibia: Filho Do Stun of Pacera

aham
deu certim msm retirar os comandos (nem tinha vido as respostas xD amlz)
tive a ideia de tentar e deu certo
mais achei mtu interessante esses comandos de MayNot
tem como eu "adicionar" esses comandos para meu OT colex?
thnx ![]()
info
Grupo: Campones
Registrado: 25/12/05
Posts: 51
Reputação: +2
perfeito, muito massa, parabens colex