Postado Agosto 29, 2017 7 anos Um script básico, onde o jogador ao utilizar determinado item, seja estátua ou porta, seja teleportado para uma localização. Feito isso, no mesmo script, após ser teleportado recebe uma mensagem, "just time 15 seg", e inicia a contagem de 15 segundos, ao final do tempo, ele toma teleport para outra posição. Mas, se tiver uma storage após iniciar a contagem, cancela o teleport. (O script tem que funcionar toda vez que clicar na porta ou estátua) Se ficou difícil de compreender, tentarei explicar de outra forma. Enviado do meu iPhone usando Tapatalk
Postado Agosto 29, 2017 7 anos Em actions/scripts, crie um arquivo.lua: local t = { newpos = {x=1,y=1,z=1}, backpos = {x=1,y=1,z=1}, storage = 11111, tempo = 15 -- em segundos } function onUse(cid, item, fromPosition, itemEx, toPosition) doTeleportThing(cid, t.newpos) doSendMagicEffect(t.newpos, CONST_ME_TELEPORT) if getPlayerStorageValue(cid, t.storage) == -1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Just time " .. t.tempo .. " sec.") addEvent(checkInativity, t.tempo*1000 ,cid) end return true end function checkInativity(cid) if isPlayer(cid) then doTeleportThing(cid, t.backpos) doSendMagicEffect(t.backpos, CONST_ME_TELEPORT) end end Em actions.xml, adicione a tag: <action actionid="ACTIONIDDAPORTAOUESTATUA" script="NOMEDOARQUIVO.lua" /> Editado Agosto 29, 2017 7 anos por Dwarfer (veja o histórico de edições)
Postado Agosto 29, 2017 7 anos Autor Em 29/08/2017 em 17:06, Dwarfer disse: Em actions/scripts, crie um arquivo.lua: local t = { newpos = {x=1,y=1,z=1}, backpos = {x=1,y=1,z=1}, storage = 11111, tempo = 15 -- em segundos } function onUse(cid, item, fromPosition, itemEx, toPosition) doTeleportThing(cid, t.newpos) doSendMagicEffect(t.newpos, CONST_ME_TELEPORT) if getPlayerStorageValue(cid, t.storage) == -1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Just time " .. t.tempo .. " sec.") addEvent(checkInativity, t.tempo*1000 ,cid) end return true end function checkInativity(cid) if isPlayer(cid) then doTeleportThing(cid, t.backpos) doSendMagicEffect(t.backpos, CONST_ME_TELEPORT) end end Em actions.xml, adicione a tag: <action actionid="ACTIONIDDAPORTAOUESTATUA" script="NOMEDOARQUIVO.lua" /> Não está ignorando o teleport caso eu tenha a storage. Acho que eu vou tentar explicar novamente; Eu tenho uma sala de premios, onde o usuário vai clicar na porta, e vai ser teleportado para X posição dentro da sala, e tera 15 segundos para pegar o premio, se não vai tomar tp para outro local, certo? (È o que você fez acima) E a parte da storage, era para o seu proprio script verificar, no final desses 15 segundos, se ele tem essa storage, se ele tiver, não manda o mesmo para outra posição. Porque não vai mandar para outra posição? Pq no bau que ele vai abrir, vai dar essa storage, e automaticamente o script do proprio bau, vai kikar ele. O que aconteceu ate agr? Mesmo abrindo o bau, e ganhando a storage, ele toma kick do seu script. É uma estrategia que eu quero bolar pro player não ficar off na sala de premios, e muito menos pegar mais que 1 premio por vez. Script do meu bau. local items = { --[numeração] = {id = ID DO ITEM, count = QUANTIDADE DO ITEM, c = CHANCE} [1]={id=8884, count=1, c=10}, -- item 1 [2]={id=8890, count=1, c=10}, -- item 2 [3]={id=8888, count=1, c=10}, -- item 3 [4]={id=8905, count=1, c=10}, -- item 4 [5]={id=10511, count=1, c=10}, -- item 5 [6]={id=10515, count=1, c=10}, -- item 6 [7]={id=10514, count=1, c=10}, -- item 7 [8]={id=10139, count=1, c=10}, -- item 8 [9]={id=10719, count=1, c=10}, -- item 9 [10]={id=12608, count=75, c=10}, -- item 9 } function getRandomItem(t) local i = math.random(1, #t) i = t[i] if math.random(1, 100) <= i.c then return i end return getRandomItem(t) end function onUse(cid, item, fromPosition, itemEx, toPosition) local i = getRandomItem(items) local effect = 28, 29, 30 local Pos = {x = 1695, y = 1637, z = 7} local PlayerPos = {x = getPlayerPosition(cid).x + 0, y = getPlayerPosition(cid).y + 0, z = getPlayerPosition(cid).z} local stor = 98543 if getPlayerStorageValue(cid,stor) == -1 then doPlayerAddItem(cid, i.id, i.count) doTeleportThing(cid, Pos) doSendMagicEffect(PlayerPos,effect) doSendAnimatedText(getPlayerPosition(cid), "Event Box!", TEXTCOLOR_YELLOW) doPlayerSendTextMessage(cid, 27, "You opened a chest event and won "..i.count.."x "..getItemNameById(i.id)..(i.count > 1 and "s" or "")..".") doRemoveItem(item.uid, 1) setPlayerStorageValue(cid,stor,1) else doPlayerSendTextMessage(cid,25,"The chest event is empty.") end return true end Seu script: local t = { newpos = {x=1679,y=1638,z=7}, backpos = {x=1695,y=1637,z=7}, storage = 98543, tempo = 15 -- em segundos } function onUse(cid, item, fromPosition, itemEx, toPosition) doTeleportThing(cid, t.newpos) doSendMagicEffect(t.newpos, CONST_ME_TELEPORT) if getPlayerStorageValue(cid, t.storage) == -1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você tem " .. t.tempo .. " segundos para pegar o prêmio.") addEvent(checkInativity, t.tempo*1000 ,cid) end return true end function checkInativity(cid) if isPlayer(cid) then doTeleportThing(cid, t.backpos) doSendMagicEffect(t.backpos, CONST_ME_TELEPORT) end end
Postado Agosto 29, 2017 7 anos Solução Ahh! Entendi. local t = { newpos = {x=1,y=1,z=1}, backpos = {x=1,y=1,z=1}, storage = 11111, tempo = 15 -- em segundos } function onUse(cid, item, fromPosition, itemEx, toPosition) doTeleportThing(cid, t.newpos) doSendMagicEffect(t.newpos, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Just time " .. t.tempo .. " sec.") addEvent(checkInativity, t.tempo*1000 ,cid) return true end function checkInativity(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, t.storage) == -1 then doTeleportThing(cid, t.backpos) doSendMagicEffect(t.backpos, CONST_ME_TELEPORT) end end end
Postado Agosto 29, 2017 7 anos Autor Em 29/08/2017 em 20:21, Dwarfer disse: Ahh! Entendi. local t = { newpos = {x=1,y=1,z=1}, backpos = {x=1,y=1,z=1}, storage = 11111, tempo = 15 -- em segundos } function onUse(cid, item, fromPosition, itemEx, toPosition) doTeleportThing(cid, t.newpos) doSendMagicEffect(t.newpos, CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Just time " .. t.tempo .. " sec.") addEvent(checkInativity, t.tempo*1000 ,cid) return true end function checkInativity(cid) if isPlayer(cid) then if getPlayerStorageValue(cid, t.storage) == -1 then doTeleportThing(cid, t.backpos) doSendMagicEffect(t.backpos, CONST_ME_TELEPORT) end end end Exatamente isso, obrigado!
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.