Ir para conteúdo

Featured Replies

Postado

Não sei se esse aki e o lugar certo si não for pesso desculpa,  no meu ot 8.60 bestbaiak esta acontecendo uma coisa estranha pq quando eu clico cave exclusiva de número 1 ela fica dono da 1 e da 2 e também quando acaba o tempo que o player da cave deve ser teleporta pro Templo ele não vai o tempo acaba a mensagem avisa mas o player não e teleportado alguém sabe me dizer oque e isso..  Obrigado quem souber deixo um REP +

  • 6 months later...
  • Respostas 33
  • Visualizações 7.2k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Bodak Reborn
    Bodak Reborn

    Como faltou algumas informações, fiz do jeito que entendi. Crie um teleport sem coordenadas pelo remeres (os que vão teleportar para a cave). Nesses teleports, coloque um action id.  

  • Bodak Reborn
    Bodak Reborn

    Eu corrigi algumas partes do código, sugiro que atualizem o de vocês para o novo.

Postado
Em 16/05/2016 em 19:00, Bodak Reborn disse:

function onStepIn(cid, item, position, fromPosition) local config = { storage = 789456, from = {x = 1049, y = 1051, z = 6}, -- coordenada do canto superior esquerdo da área. to = {x = 1051, y = 1053, z = 7}, -- coordenada do canto inferior direito da área. maxPlayers = 1, -- quantos jogadores poderão entrar na área ao mesmo tempo. pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado. } local function getPlayersInArea(left, right) local playersInArea = {} for _, cid in ipairs(getPlayersOnline()) do if isInRange(getThingPos(cid), left, right) then table.insert(playersInArea, cid) end end return playersInArea end if isPlayer(cid) then if getPlayerStorageValue (cid, config.storage) < os.time() then doPlayerSendTextMessage(cid, 19, "MSG caso o player não tenha acesso.") doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doTeleportThing(cid, fromPosition, true) else doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) end if table.getn(getPlayersInArea(config.from, config.to)) < config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then doSendMagicEffect(fromPosition, CONST_ME_TELEPORT) doTeleportThing (cid, config.pos) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then doPlayerSendTextMessage (cid, 19, "MSG caso já tenha o limite de jogadores dentro da área.") doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) doTeleportThing(cid, fromPosition, true) end end return true end

 

Em 16/05/2016 em 19:00, Bodak Reborn disse:

Como faltou algumas informações, fiz do jeito que entendi.

Crie um teleport sem coordenadas pelo remeres (os que vão teleportar para a cave).

Nesses teleports, coloque um action id.

 

movements/scripts

nome_arquivo.lua


function onStepIn(cid, item, position, fromPosition)
	local config = {
	storage = 789456,
	from = {x = 1049, y = 1051, z = 6}, -- coordenada do canto superior esquerdo da área.
	to = {x = 1051, y = 1053, z = 7}, -- coordenada do canto inferior direito da área.
	maxPlayers = 1, -- quantos jogadores poderão entrar na área ao mesmo tempo.
	pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado.
	}
	
	local function getPlayersInArea(left, right)
		local playersInArea = {}
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), left, right) then
				table.insert(playersInArea, cid)
			end
		end
	return playersInArea
	end
	
	if isPlayer(cid) then
		if getPlayerStorageValue (cid, config.storage) < os.time() then
			doPlayerSendTextMessage(cid, 19, "MSG caso o player não tenha acesso.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		else
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		end
	
		if table.getn(getPlayersInArea(config.from, config.to)) < config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
			doTeleportThing (cid, config.pos)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doPlayerSendTextMessage (cid, 19, "MSG caso já tenha o limite de jogadores dentro da área.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		end
	end
return true
end

 

movements.xml


<movevent type="StepIn" actionid="ACTION_ID_DO_TP" event="script" value="nome_arquivo.lua" />

 

actions/scripts

nome_arquivo.lua


function onUse(cid, item, frompos, item2, topos)
	local config = {
	timeExhausted = 24, -- tempo em horas para poder usar o item novamente.
	timeForUse = 6, -- tempo em horas que o player poderá entrar na cave.
	exhausted = 456789,
	storage = 789456,
	toKnow = 123456,
	effect = 27, -- efeito que dará ao usar o item.
	}
	
	if getPlayerStorageValue(cid, config.exhausted) < os.time() then
		setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.toKnow, 1)
		doSendMagicEffect (getThingPos(cid), config.effect)
		doPlayerSendTextMessage (cid, 19, "MSG informando que o jogador tem acesso à área.")
	else
		doPlayerSendTextMessage (cid, 19, "MSG caso o player esteja exhaustado. (Sobre ter que esperar 24 horas)")
	end
return true
end

 

actions.xml


<action itemid="ID_DO_ITEM" event="script" value="nome_arquivo.lua"/>

 

creaturescripts/scripts

nome_arquivo.lua


local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}

function onKill(cid, target, lastHit)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage) < os.time () then
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doRemoveCreature (cid)
		end
	end
return true
end

function onLogin(cid)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage)  < os.time () then
			doTeleportThing (cid, config.pos)
			setPlayerStorageValue (cid, config.toKnow, 0)
		end
	end
return true
end

 

creaturescripts.xml


<event type="login" name="timeAcess" event="script" value="nome_arquivo.lua"/>
<event type="kill" name="timeAcessKill" event="script" value="nome_arquivo.lua"/>

 

Em creaturescripts/login.lua procure por "registerCreatureEvent" e coloque isso embaixo:


registerCreatureEvent(cid, "timeAcess")
registerCreatureEvent(cid, "timeAcessKill")

 

PS: Eu testei apenas os códigos de actions e movements. Não testei os códigos de creaturescripts, logo, são passíveis de erros.

 

 

 

A parte de nao deixar outro player entrar nao funcionou pra mim.. coloquei as coordenadas e talz... ele da pra entrar quantos player quizer pelo teleport

  • 7 months later...
Postado
Em 16/05/2016 em 19:00, Bodak Reborn disse:

Como faltou algumas informações, fiz do jeito que entendi.

Crie um teleport sem coordenadas pelo remeres (os que vão teleportar para a cave).

Nesses teleports, coloque um action id.

 

movements/scripts

nome_arquivo.lua


function onStepIn(cid, item, position, fromPosition)
	local config = {
	storage = 789456,
	from = {x = 1049, y = 1051, z = 6}, -- coordenada do canto superior esquerdo da área.
	to = {x = 1051, y = 1053, z = 7}, -- coordenada do canto inferior direito da área.
	maxPlayers = 1, -- quantos jogadores poderão entrar na área ao mesmo tempo.
	pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado.
	}
	
	local function getPlayersInArea(left, right)
		local playersInArea = {}
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), left, right) then
				table.insert(playersInArea, cid)
			end
		end
	return playersInArea
	end
	
	if isPlayer(cid) then
		if getPlayerStorageValue (cid, config.storage) < os.time() then
			doPlayerSendTextMessage(cid, 19, "MSG caso o player não tenha acesso.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		else
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		end
	
		if table.getn(getPlayersInArea(config.from, config.to)) < config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
			doTeleportThing (cid, config.pos)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doPlayerSendTextMessage (cid, 19, "MSG caso já tenha o limite de jogadores dentro da área.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		end
	end
return true
end

 

movements.xml


<movevent type="StepIn" actionid="ACTION_ID_DO_TP" event="script" value="nome_arquivo.lua" />

 

actions/scripts

nome_arquivo.lua


function onUse(cid, item, frompos, item2, topos)
	local config = {
	timeExhausted = 24, -- tempo em horas para poder usar o item novamente.
	timeForUse = 6, -- tempo em horas que o player poderá entrar na cave.
	exhausted = 456789,
	storage = 789456,
	toKnow = 123456,
	effect = 27, -- efeito que dará ao usar o item.
	}
	
	if getPlayerStorageValue(cid, config.exhausted) < os.time() then
		setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.toKnow, 1)
		doSendMagicEffect (getThingPos(cid), config.effect)
		doPlayerSendTextMessage (cid, 19, "MSG informando que o jogador tem acesso à área.")
	else
		doPlayerSendTextMessage (cid, 19, "MSG caso o player esteja exhaustado. (Sobre ter que esperar 24 horas)")
	end
return true
end

 

actions.xml


<action itemid="ID_DO_ITEM" event="script" value="nome_arquivo.lua"/>

 

creaturescripts/scripts

nome_arquivo.lua


local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}

function onKill(cid, target, lastHit)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage) < os.time () then
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doRemoveCreature (cid)
		end
	end
return true
end

function onLogin(cid)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage)  < os.time () then
			doTeleportThing (cid, config.pos)
			setPlayerStorageValue (cid, config.toKnow, 0)
		end
	end
return true
end

 

creaturescripts.xml


<event type="login" name="timeAcess" event="script" value="nome_arquivo.lua"/>
<event type="kill" name="timeAcessKill" event="script" value="nome_arquivo.lua"/>

 

Em creaturescripts/login.lua procure por "registerCreatureEvent" e coloque isso embaixo:


registerCreatureEvent(cid, "timeAcess")
registerCreatureEvent(cid, "timeAcessKill")

 

PS: Eu testei apenas os códigos de actions e movements. Não testei os códigos de creaturescripts, logo, são passíveis de erros.

 

Ola tem como quando clicar no item, verificar se ja tem alguem na sala? porque se ja tem alguem la dentro e vc acabar usando o item vai perder o tempo... pq vc perde o item e ja tem alguem usando  hunt..

Postado
Em 16/05/2016 em 19:00, Bodak Reborn disse:

Como faltou algumas informações, fiz do jeito que entendi.

Crie um teleport sem coordenadas pelo remeres (os que vão teleportar para a cave).

Nesses teleports, coloque um action id.

 

movements/scripts

nome_arquivo.lua


function onStepIn(cid, item, position, fromPosition)
	local config = {
	storage = 789456,
	from = {x = 1049, y = 1051, z = 6}, -- coordenada do canto superior esquerdo da área.
	to = {x = 1051, y = 1053, z = 7}, -- coordenada do canto inferior direito da área.
	maxPlayers = 1, -- quantos jogadores poderão entrar na área ao mesmo tempo.
	pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado.
	}
	
	local function getPlayersInArea(left, right)
		local playersInArea = {}
		for _, cid in ipairs(getPlayersOnline()) do
			if isInRange(getThingPos(cid), left, right) then
				table.insert(playersInArea, cid)
			end
		end
	return playersInArea
	end
	
	if isPlayer(cid) then
		if getPlayerStorageValue (cid, config.storage) < os.time() then
			doPlayerSendTextMessage(cid, 19, "MSG caso o player não tenha acesso.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		else
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		end
	
		if table.getn(getPlayersInArea(config.from, config.to)) < config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
			doTeleportThing (cid, config.pos)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
		elseif table.getn(getPlayersInArea(config.from, config.to)) >= config.maxPlayers and getPlayerStorageValue (cid, config.storage) > os.time() then
			doPlayerSendTextMessage (cid, 19, "MSG caso já tenha o limite de jogadores dentro da área.")
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, fromPosition, true)
		end
	end
return true
end

 

movements.xml


<movevent type="StepIn" actionid="ACTION_ID_DO_TP" event="script" value="nome_arquivo.lua" />

 

actions/scripts

nome_arquivo.lua


function onUse(cid, item, frompos, item2, topos)
	local config = {
	timeExhausted = 24, -- tempo em horas para poder usar o item novamente.
	timeForUse = 6, -- tempo em horas que o player poderá entrar na cave.
	exhausted = 456789,
	storage = 789456,
	toKnow = 123456,
	effect = 27, -- efeito que dará ao usar o item.
	}
	
	if getPlayerStorageValue(cid, config.exhausted) < os.time() then
		setPlayerStorageValue (cid, config.storage, config.timeForUse * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.exhausted, config.timeExhausted * 60 * 60 + os.time())
		setPlayerStorageValue (cid, config.toKnow, 1)
		doSendMagicEffect (getThingPos(cid), config.effect)
		doPlayerSendTextMessage (cid, 19, "MSG informando que o jogador tem acesso à área.")
	else
		doPlayerSendTextMessage (cid, 19, "MSG caso o player esteja exhaustado. (Sobre ter que esperar 24 horas)")
	end
return true
end

 

actions.xml


<action itemid="ID_DO_ITEM" event="script" value="nome_arquivo.lua"/>

 

creaturescripts/scripts

nome_arquivo.lua


local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 1050, y = 1056, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}

function onKill(cid, target, lastHit)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage) < os.time () then
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doRemoveCreature (cid)
		end
	end
return true
end

function onLogin(cid)
	if getPlayerStorageValue (cid, config.toKnow) == 1 then
		if getPlayerStorageValue (cid, config.storage)  < os.time () then
			doTeleportThing (cid, config.pos)
			setPlayerStorageValue (cid, config.toKnow, 0)
		end
	end
return true
end

 

creaturescripts.xml


<event type="login" name="timeAcess" event="script" value="nome_arquivo.lua"/>
<event type="kill" name="timeAcessKill" event="script" value="nome_arquivo.lua"/>

 

Em creaturescripts/login.lua procure por "registerCreatureEvent" e coloque isso embaixo:


registerCreatureEvent(cid, "timeAcess")
registerCreatureEvent(cid, "timeAcessKill")

 

PS: Eu testei apenas os códigos de actions e movements. Não testei os códigos de creaturescripts, logo, são passíveis de erros.

 

 

 

Tem como colocar para outro player não poder usar o item que da acesso, enquanto já tem alguém la dentro, pois se já tiver alguém la dentro e vc usar o item vc vai perder o item.

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo