Postado Março 8, 2021 4 anos Pessoal, tenho uma script que o player ganha x item e volta para o cp quando não tem ninguem em x area, mas eu gostaria de fazer com que essa script fosse ativada depois de 5 segundos após o player pisar nesse tile. Exemplo: Player pisa no tile, da 5 segundos e o script é ativado Se não tiver ninguem nessa area, o script passa 5 segundos e funciona normal, caso tenha player nessa area, o script não funciona! A script ja esta ok, só falta adicionar 5 segundos function onStepIn(cid, item, position, fromPosition) local pos = {x = 1037, y = 1034, z = 7} local battlewin = 1 if #getCreatureSummons(cid) >= 1 then else if #getPlayersInArea(battleroyale.area) > 1 then return true end doTeleportThing(cid, pos) local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) return true end end
Postado Março 8, 2021 4 anos Tenta ai: local pos = {x = 1037, y = 1034, z = 7} local time = 5 -- segundos local function teleportPlayer(cid, seconds) if isPlayer(cid) and not isPlayerGhost(cid) then addEvent(function() if(isCreature(cid)) then doTeleportThing(cid, pos) end end, 1000 * seconds) if seconds > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você será teleportado em "..seconds.." segundo(s).") addEvent(teleportPlayer, 1000, cid, seconds-1) end end end function onStepIn(cid, item, position, fromPosition) local battlewin = 1 if #getCreatureSummons(cid) >= 1 then else if #getPlayersInArea(battleroyale.area) > 1 then return true end teleportPlayer(cid, time) local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) return true end end ╔══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ══════════════════════════╗ Te Ajudei? Rep + e ficamos Quits Precisando de ajuda? Discord: Yan Liima #3702 Programador Júnior de LUA, PHP e JavaScript Juntos somos lendas, separados somos Mitos! ╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝
Postado Março 8, 2021 4 anos Autor 14 minutos atrás, Yan Liima disse: Tenta ai: local pos = {x = 1037, y = 1034, z = 7} local time = 5 -- segundos local function teleportPlayer(cid, seconds) if isPlayer(cid) and not isPlayerGhost(cid) then addEvent(function() if(isCreature(cid)) then doTeleportThing(cid, pos) end end, 1000 * seconds) if seconds > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você será teleportado em "..seconds.." segundo(s).") addEvent(teleportPlayer, 1000, cid, seconds-1) end end end function onStepIn(cid, item, position, fromPosition) local battlewin = 1 if #getCreatureSummons(cid) >= 1 then else if #getPlayersInArea(battleroyale.area) > 1 then return true end teleportPlayer(cid, time) local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) return true end end Passo no piso, ele aparece a mensagem que eu ganhei o evento mas não passa os 5 segundos... Como se não tivesse a função de tempo, no caso não queria uma script que teleporta-se... queria uma script que ativaria a script somente depois de 5 segundos após ele ter pisado no tile... Editado Março 8, 2021 4 anos por GniusPlay (veja o histórico de edições)
Postado Março 8, 2021 4 anos Solução tile_storage = 876448 function doTeleportWithDelay(cid, pos, delay) -- by vodkart if not isCreature(cid) then return LUA_ERROR end if delay > 0 then if #getPlayersInArea(battleroyale.area) > 1 then setPlayerStorageValue(cid, tile_storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} O teletransporte foi desativado ainda existem pessoas na area.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} "..delay.." segundos para se teletransportar.") addEvent(doTeleportWithDelay, 1000, cid, pos, delay-1) else doTeleportThing(cid, pos) doSendMagicEffect(getPlayerPosition(cid), 10) local battlewin = 1 local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) setPlayerStorageValue(cid, tile_storage, -1) end end function onStepIn(cid, item, position, fromPosition) local pos = {x = 1037, y = 1034, z = 7} local time = 5 -- segundos if #getPlayersInArea(battleroyale.area) > 1 then return true end if getPlayerStorageValue(cid, tile_storage) <= 0 then doTeleportWithDelay(cid, pos, time) setPlayerStorageValue(cid, tile_storage, 1) end return true end Editado Março 8, 2021 4 anos por Vodkart (veja o histórico de edições) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Março 8, 2021 4 anos Autor 23 minutos atrás, Vodkart disse: tile_storage = 876448 function doTeleportWithDelay(cid, pos, delay) -- by vodkart if not isCreature(cid) then return LUA_ERROR end if delay > 0 then if #getPlayersInArea(battleroyale.area) > 1 then setPlayerStorageValue(cid, tile_storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} O teletransporte foi desativado ainda existem pessoas na area.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Battle Royale Teleport} "..delay.." segundos para se teletransportar.") addEvent(doTeleportWithDelay, 1000, cid, pos, delay-1) else doTeleportThing(cid, pos) doSendMagicEffect(getPlayerPosition(cid), 10) local battlewin = 1 local item = doPlayerAddItem(cid, 5805, 1) doItemSetAttribute(item, "description", getCreatureName(cid).." conquistou este trofeu apos vencer uma partida no Battle Royale.") doBroadcastMessage(""..getCreatureName(cid).." Venceu o evento Battle Royale") doPlayerAddItem(cid,12618,1) doPlayerAddItem(cid,2152,30) addTopbattle(cid, battlewin) setPlayerStorageValue(cid, tile_storage, -1) end end function onStepIn(cid, item, position, fromPosition) local pos = {x = 1037, y = 1034, z = 7} local time = 5 -- segundos if #getPlayersInArea(battleroyale.area) > 1 then return true end if getPlayerStorageValue(cid, tile_storage) <= 0 then doTeleportWithDelay(cid, pos, time) setPlayerStorageValue(cid, tile_storage, 1) end return true end Quase perfeito mano, só faltou um detalhe, se por exemplo um player chegasse nessa area, queria q o tempo de 5 segundos fosse cancelado. Exemplo: Não tem ninguem na area, o teleport vai acontecer em 5 segundos, até ai ok, porém se aparecesse alguém nessa area durante esses 5 segundos, o teleprot seria cancelado Editado Março 8, 2021 4 anos por GniusPlay (veja o histórico de edições)
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.