Ir para conteúdo

Featured Replies

Postado

gostaria de saber se da pra por esse evento automatico, ele é um evento de castelo 

 

queria por ele toda segunda,quinta, sabado

 

 

Mostrar conteúdo oculto

 

Resolvido por Vodkart

Ir para solução
  • Respostas 21
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • sim e era para remover, estranho hein... testa em outra house pra ver se passa, troca o id lá naquela linha o 223 por outra house só para testar local THRONE_POS = {x = 2561, y = 2446, z = 5} local

Posted Images

Postado
local THRONE_POS = {x = 2561, y = 2446, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 15 -- in minutes
local days = {"Monday", "Saturday", "Thursday"} -- coloque os dias
function OpenEvent()	
	for _, tid in ipairs(getPlayersOnline()) do		
		setPlayerStorageValue(tid, STORAGE_PLAYER, 1)		
	end	
	setGlobalStorageValue(STORAGE_EVENT, 1)	
	doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25)	
end
function getWinnerCastle()	
	CastleWalls()	
	local player = getTopCreature(THRONE_POS).uid	
	if getGlobalStorageValue(STORAGE_EVENT) < 0 then		
		return true		
	end	
	if (isPlayer(player)) then		
		if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then			
			local pid = getPlayerGUID(player)			
			setHouseOwner(6257, pid)			
			doPlayerAddPremiumDays(player, 7)			
			for _, cid in ipairs(getPlayersOnline()) do				
				setPlayerStorageValue(cid, STORAGE_PLAYER, 0)				
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))				
			end			
			doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25)			
			doTeleportThing(player, {x = 2531, y = 2460, z = 7})			
			doCreateItem(391, 1, {x = 2561, y = 2446, z = 5})			
		end		
	else		
		doBroadcastMessage("Ningúem ganhou o evento.", 27)		
		for _, pid in ipairs(getPlayersOnline()) do			
			setPlayerStorageValue(pid, STORAGE_PLAYER, 0)			
			doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))			
		end		
	end	
	setGlobalStorageValue(STORAGE_EVENT, 0)	
	return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER)	
end
function isEventDay()
	for _, dia in pairs(days) do
		if dia == os.date("%A") then
			return true
		end
	end
	return false
end
function CastleWalls()
	local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285)	
	local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687)	
	if pedra.uid > 0 then		
		return doRemoveItem(pedra.uid)		
	else		
		return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7})		
	end
	if escada.uid > 0 then		
		return doRemoveItem(escada.uid)		
	else		
		return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})		
	end	
end
function onTimer()
	if isEventDay() and getGlobalStorageValue(STORAGE_EVENT) <= 0 then
		doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
		OpenEvent()
		CastleWalls()
		addEvent(getWinnerCastle, DUR * 60 * 1000)
	end
	return true
end

 

TAG

 

<globalevent name="castle automatic" time="20:00" event="script" value="nome do seu script.lua"/>

 

Postado
  • Autor

Vou testar e aviso

  Em 02/09/2021 em 18:25, Vodkart disse:
local THRONE_POS = {x = 2561, y = 2446, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 15 -- in minutes
local days = {"Monday", "Saturday", "Thursday"} -- coloque os dias
function OpenEvent()	
	for _, tid in ipairs(getPlayersOnline()) do		
		setPlayerStorageValue(tid, STORAGE_PLAYER, 1)		
	end	
	setGlobalStorageValue(STORAGE_EVENT, 1)	
	doBroadcastMessage("O Evento castle foi aberto e vai durar ".. DUR .." minutos.", 25)	
end
function getWinnerCastle()	
	CastleWalls()	
	local player = getTopCreature(THRONE_POS).uid	
	if getGlobalStorageValue(STORAGE_EVENT) < 0 then		
		return true		
	end	
	if (isPlayer(player)) then		
		if (getPlayerStorageValue(player, STORAGE_PLAYER) > 0) then			
			local pid = getPlayerGUID(player)			
			setHouseOwner(6257, pid)			
			doPlayerAddPremiumDays(player, 7)			
			for _, cid in ipairs(getPlayersOnline()) do				
				setPlayerStorageValue(cid, STORAGE_PLAYER, 0)				
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))				
			end			
			doBroadcastMessage(getCreatureName(player) .. " ganhou o evento.", 25)			
			doTeleportThing(player, {x = 2531, y = 2460, z = 7})			
			doCreateItem(391, 1, {x = 2561, y = 2446, z = 5})			
		end		
	else		
		doBroadcastMessage("Ningúem ganhou o evento.", 27)		
		for _, pid in ipairs(getPlayersOnline()) do			
			setPlayerStorageValue(pid, STORAGE_PLAYER, 0)			
			doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)))			
		end		
	end	
	setGlobalStorageValue(STORAGE_EVENT, 0)	
	return db.executeQuery("DELETE FROM `player_storage` WHERE `key` = " .. STORAGE_PLAYER)	
end
function isEventDay()
	for _, dia in pairs(days) do
		if dia == os.date("%A") then
			return true
		end
	end
	return false
end
function CastleWalls()
	local pedra = getTileItemById({ x = 2539, y = 2474, z = 7}, 1285)	
	local escada = getTileItemById({ x = 2539, y = 2474, z = 7}, 3687)	
	if pedra.uid > 0 then		
		return doRemoveItem(pedra.uid)		
	else		
		return doCreateItem(1285, 1, { x = 2539, y = 2474, z = 7})		
	end
	if escada.uid > 0 then		
		return doRemoveItem(escada.uid)		
	else		
		return doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})		
	end	
end
function onTimer()
	if isEventDay() and getGlobalStorageValue(STORAGE_EVENT) <= 0 then
		doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
		OpenEvent()
		CastleWalls()
		addEvent(getWinnerCastle, DUR * 60 * 1000)
	end
	return true
end

 

TAG

 

<globalevent name="castle automatic" time="20:00" event="script" value="nome do seu script.lua"/>

 

VODkart o programa iniciou o evento normalmente mas tem 1 probleminha 

tipo queria q quando acabar o evento o player q ganhou ganharia o castelo mas não ta passando a house pra o vencedor

 

 

1856068933_wislandhouse.thumb.png.22df134196ce8c8154e3f2f41263a4a6.png

 

Postado

é pq no seu código está outra house id né... 

 

nessa linha:

 

setHouseOwner(6257, pid)

troca por:

setHouseOwner(223, pid, true)

 

 

## EDIT ##

 

era "pid" ao invés de "player" ... já arrumei!!

-------------------------

 

EDITEI O TÓPICO, ARRUMEI A VARIÁVEL!! 

Editado por Vodkart (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.6k

Informação Importante

Confirmação de Termo