Ir para conteúdo

Featured Replies

Postado
  • Autor
  Em 03/09/2021 em 00:00, Vodkart disse:

é 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!! 

eu mudei pra 

setHouseOwner(223, pid, true)

mas agora o evento não quer nem iniciar o evento, mas não aparece nem um erro 

  • 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
  Em 03/09/2021 em 00:28, Gatinha Pirada disse:

aparece nem um erro só que o evento não inicia mais

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(223, pid, true)			
			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() then
		doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
		OpenEvent()
		CastleWalls()
		addEvent(getWinnerCastle, DUR * 60 * 1000)
	end
	return true
end

 

Postado
  • Autor
  Em 03/09/2021 em 00:32, 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(223, pid, true)			
			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() then
		doCreateItem(3687, 1, {x = 2539, y = 2474, z = 7})
		OpenEvent()
		CastleWalls()
		addEvent(getWinnerCastle, DUR * 60 * 1000)
	end
	return true
end

 

O evento funcionou mas a house não passou para o vencedor

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