Tem Como Adicionar Isso Nesse Script?

MonsterOt
em Scripts

MonsterOt

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 21/07/12Posts: 65

teria como fazer se o player sair do tile antes de ser teleportado o tempo pare de contar, e se ele entrar de volta no tile comece a contar do 0.

 

Tem como fazer isso?

 

local events ={}

local tempo = 30 -- tempo em segundos

local pos = {x = 1, y = 1, z = 1}

local function doTeleportThingNoError(guid, pos)

local cid = getPlayerByGUID(guid)

if not isCreature(cid) then return end

doTeleportThing(cid, pos)

end

 

function onStepIn(cid, item, oldPos)

doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")

events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)

return true

end

 

function onStepOut(cid, item, pos)

doPlayerSendTextMessage(cid, 28, "Contagem zerada.")

stopEvent(events[getPlayerGUID(cid)])

events[getPlayerGUID(cid)] = nil

return true

end

Oneshot

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 05/07/09Posts: 1347

local config = {
   wait = 30 -- TEMPO DE EXECUÇÃO DO TELEPORTE; EM SEGUNDOS
   position = {x = 1, y = 1, z = 7} -- POSIÇÃO DE TELEPORTE
   events = {}
}

function teleportEvent(cid, seconds)
   if not isCreature(cid) then
       config.events[cid] = nil
       return true
   end

   seconds = seconds - 1
   if seconds == 0 then
       doTeleportThing(cid, config.position)
       config.events[cid] = nil
   else
       config.events[cid] = addEvent(teleportEvent, 1 * 1000, cid, (seconds - 1))
   end
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Contagem iniciada. Você será teleportado em ".. config.wait .." segundos.")
   config.events[cid] = addEvent(teleportEvent, 1 * 1000, cid, config.wait)
   return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Não saia do piso!\nContagem zerada.")
   stopEvent(config.events[cid])
   config.events[cid] = nil
   return true
end

 

Fiz de cabeça, talvez não funcione. Faça um teste e me avise.

MonsterOt

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 21/07/12Posts: 65

Deu esse erro:

 

dkm92gpf7wdd0ocffe1q.png

 

Quando sai do tile o tempo já para.

 

oque eu quero mesmo é quando sair do tile o tempo volte para "0"

LuckOake

avatar
Marquês
Marquês

INFOS

Grupo: MarquêsRegistrado: 23/07/12Posts: 1104Gênero: MasculinoChar no Tibia: Luck Oake

Faltou umas vírgulas no config.

 

 

local config = {

wait = 30, -- TEMPO DE EXECUÇÃO DO TELEPORTE; EM SEGUNDOS

position = {x = 1, y = 1, z = 7}, -- POSIÇÃO DE TELEPORTE

events = {}

}

 

function teleportEvent(cid, seconds)

if not isCreature(cid) then

config.events[cid] = nil

return true

end

 

seconds = seconds - 1

if seconds == 0 then

doTeleportThing(cid, config.position)

config.events[cid] = nil

else

config.events[cid] = addEvent(teleportEvent, 1 * 1000, cid, (seconds - 1))

end

end

 

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Contagem iniciada. Você será teleportado em ".. config.wait .." segundos.")

config.events[cid] = addEvent(teleportEvent, 1 * 1000, cid, config.wait)

return true

end

 

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Não saia do piso!\nContagem zerada.")

stopEvent(config.events[cid])

config.events[cid] = nil

return true

end

 

 

PS: Créditos inteiramente do Oneshot, estou apenas corrigindo um erro.

MonsterOt

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 21/07/12Posts: 65

Ta bugado worriedsmiley.gif

 

depois que passa 30 segundos o player nao é teleportado

brun123

vash
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 24/09/06Posts: 512

você configurou a posição? essa script que o notle postou está diminuindo o "seconds" em 2 a cada segundo, não sei se vocês perceberam...

 

MonsterOt, cara, já te passei 2x em outros tópicos essa script... em vez de ficar pedindo várias vezes a mesma coisa, porque não especifica ao máximo o que você realmente quer? depende do que você quer fazer, talvez nem precisa de onStepOut, talvez precise implementar a função isInRange...

 

 

local events ={}
local tempo = 30 -- tempo em segundos
local pos = {x = 1, y = 1, z = 1}

local function doTeleportThingNoError(guid, pos)
local cid = getPlayerByGUID(guid)
events[guid] = nil
if not isCreature(cid) then return end
doTeleportThing(cid, pos)
end

function onStepIn(cid, item, oldPos)
if events[getPlayerGUID(cid)] then
   stopEvent(events[getPlayerGUID(cid)])
   doPlayerSendTextMessage(cid, 27, "Contagem zerada.")
end
doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")
events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)
return true
end

 

5303fg1.png

notle2012

uoʇן£
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 03/01/12Posts: 884Char no Tibia: Segredo

você configurou a posição? essa script que o notle postou está diminuindo o "seconds" em 2 a cada segundo, não sei se vocês perceberam...

 

MonsterOt, cara, já te passei 2x em outros tópicos essa script... em vez de ficar pedindo várias vezes a mesma coisa, porque não especifica ao máximo o que você realmente quer? depende do que você quer fazer, talvez nem precisa de onStepOut, talvez precise implementar a função isInRange...

 

 

local events ={}
local tempo = 30 -- tempo em segundos
local pos = {x = 1, y = 1, z = 1}

local function doTeleportThingNoError(guid, pos)
local cid = getPlayerByGUID(guid)
events[guid] = nil
if not isCreature(cid) then return end
doTeleportThing(cid, pos)
end

function onStepIn(cid, item, oldPos)
if events[getPlayerGUID(cid)] then
stopEvent(events[getPlayerGUID(cid)])
doPlayerSendTextMessage(cid, 27, "Contagem zerada.")
end
doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")
events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)
return true
end

 

 

rsrs realmente os tópico do monsterot parece quase a mesma coisa coloca mais detalhes fica mais fácil pra ajuda

eu ja vi brun123 postando umas 2 vez pra te ajuda em outros topico não sei cade link quando achar edit aqui

Por Favor quando for fazer pedidos faz o pedido com mais clareza e com os mínimos detalhes
GOSTO DOS MEUS SCRIPT CLICK EM CURTIR :D

 

sistema de fome

TROCA TROCA

sistema coliseum by notle v1

new sistema [KILLER-UP]

 

 

jcLmJPT.png

MonsterOt

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 21/07/12Posts: 65

foi mal por nao explicar melhor

 

ta quase perfeito seu script brun123 só falto isso:

 

quando o player sair do tile o tempo para de contar

notle2012

uoʇן£
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 03/01/12Posts: 884Char no Tibia: Segredo

pelo oq eu entendi esse pode ressorver seu problema testa ai

local events ={}
local tempo = 30 -- tempo em segundos
local pos = {x = 160, y = 54, z = 7}
local function doTeleportThingNoError(guid, pos)
local cid = getPlayerByGUID(guid)
events[guid] = nil
if not isCreature(cid) then return end
doTeleportThing(cid, pos)
doCreatureSetNoMove(cid, false)
end
function onStepIn(cid, item, oldPos)
if events[getPlayerGUID(cid)] then
    stopEvent(events[getPlayerGUID(cid)])
    doPlayerSendTextMessage(cid, 27, "Contagem zerada.")
end
doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")
doCreatureSetNoMove(cid, true)
events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)
return true
end

Por Favor quando for fazer pedidos faz o pedido com mais clareza e com os mínimos detalhes
GOSTO DOS MEUS SCRIPT CLICK EM CURTIR :D

 

sistema de fome

TROCA TROCA

sistema coliseum by notle v1

new sistema [KILLER-UP]

 

 

jcLmJPT.png

MonsterOt

avatar
Banidos
Banidos

INFOS

Grupo: BanidosRegistrado: 21/07/12Posts: 65

notle2012

 

o player nao pode se mover porque?

 

eu so queria que na hora que o player sair de cima do tile, o tempo dos 30 segundos pare de contar. e depois que o player voltar no tile o tempo volte para "0" e comece a contar tudo de novo

 

o script do brun123 ja faz quando o player volta no tile o tempo ficar "0", só falta fazer o tempo parar de correr na hora que o player sai do tile

 

happy.png

brun123

vash
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 24/09/06Posts: 512

Tem que colocar as tags de stepin/stepout

 

 

local events ={}
local tempo = 30 -- tempo em segundos
local pos = {x = 1, y = 1, z = 1}

local function doTeleportThingNoError(guid, pos)
local cid = getPlayerByGUID(guid)
events[guid] = nil
if not isCreature(cid) then return end
doTeleportThing(cid, pos)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if events[getPlayerGUID(cid)] then
stopEvent(events[getPlayerGUID(cid)])
doPlayerSendTextMessage(cid, 27, "Contagem zerada.")
end
doPlayerSendTextMessage(cid, 27, "Contagem iniciada, daqui " .. tempo .. " segundos você será teleportado")
events[getPlayerGUID(cid)] = addEvent(doTeleportThingNoError, tempo * 1000, getPlayerGUID(cid), pos)
return true
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if events[getPlayerGUID(cid)] then
stopEvent(events[getPlayerGUID(cid)])
events[getPlayerGUID(cid)] = nil
doPlayerSendTextMessage(cid, 27, "Contagem zerada.")
end
end[/spoiler]

5303fg1.png

SuddenAttack

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 11/09/12Posts: 3

Suspenderam minha conta..

 

como faz esse stepin/stepout?

 

 

rep+ pros 2 que tentam me ajudar vlw

notle2012

uoʇן£
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 03/01/12Posts: 884Char no Tibia: Segredo

notle2012

 

o player nao pode se mover porque?

 

eu so queria que na hora que o player sair de cima do tile, o tempo dos 30 segundos pare de contar. e depois que o player voltar no tile o tempo volte para "0" e comece a contar tudo de novo

 

o script do brun123 ja faz quando o player volta no tile o tempo ficar "0", só falta fazer o tempo parar de correr na hora que o player sai do tile

 

happy.png

ata mais esse tbm era bom assim player não ia se move ate passa 30s

, brun123 posto outro ver ai veio :D

 

Tem que colocar as tags de stepin/stepout

fica em

data\movements\movements.xml

Por Favor quando for fazer pedidos faz o pedido com mais clareza e com os mínimos detalhes
GOSTO DOS MEUS SCRIPT CLICK EM CURTIR :D

 

sistema de fome

TROCA TROCA

sistema coliseum by notle v1

new sistema [KILLER-UP]

 

 

jcLmJPT.png