Ir para conteúdo

Featured Replies

Postado

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

 

Resolvido por Vodkart

Ir para solução
  • Respostas 8
  • Visualizações 853
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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) >

Postado

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

166420979_logoyanliimaornight.png.33f822b8970081a5b3646e85dbfd5934.png

Precisando de ajuda?

discord.png.1ecd188791d0141f74d99db371a2e0a4.png.890d5a38d7bcde75543c72b624a65de1.pngDiscord: Yan Liima #3702

Programador Júnior de LUA, PHP e JavaScript

Juntos somos lendas, separados somos Mitos!

╚══════════════════════════ҳ̸Ҳ̸ҳஜ۩۞۩ஜҳ̸Ҳ̸ҳ═════════════════════════════╝

Postado
  • 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 por GniusPlay (veja o histórico de edições)

Postado
  • 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 por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
  • 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 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo