Ir para conteúdo

Featured Replies

Postado
5 minutos atrás, vitinhoo96 disse:

que esse erro occore quando eu dou use no livro

ah então é só vc por isso: 
 

local gsto = getGlobalStorageValue(realCastle.dateStorages)

 
 

no lugar da gsto

22 horas atrás, vitinhoo96 disse:

local gsto = getGlobalStorageValue

 

  • Respostas 10
  • Visualizações 747
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • So volto tarde
    So volto tarde

    Este tópico foi movido para a seção de Suporte Otserv. não tem nada relacionado ao castle na sua pasta lib?

  • é pq teu gsto, não ta recebendo nada mano o certo era getGlobalStorageValue(6565656), ai sim funcionaria normal, tem q ver daonde ele puxa essa global storage isso foi só um exemplo ta, e

  • ah então é só vc por isso:    local gsto = getGlobalStorageValue(realCastle.dateStorages)     no lugar da gsto  

Postado
  • Solução
Em 31/03/2022 em 15:29, vitinhoo96 disse:

na pasta data/lib tem esse aquivo realcastle.lua

  Ocultar conteúdo


realCastle = {
	
	open_storage = 722374,
	guild_storage = 722375,
	date_storages = {722376,722377,722378},
	open_days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Wednesday","Saturday"},
	frompos = {x = 3166, y = 260, z = 7},
	topos = {x = 3293, y = 337, z = 7}

}

realCastle.removePlayers = function()
	local first_cave = getPlayersInArea({x = 2829, y = 7, z = 7},{x = 3118, y = 467, z = 7})
	local second_cave = getPlayersInArea({x = 2902, y = 340, z = 7},{x = 3445, y = 585, z = 7})
	local fifith_cave = getPlayersInArea({x = 3304, y = 192, z = 7},{x = 3687, y = 340, z = 7})
	local sixth_cave = getPlayersInArea({x = 3595, y = 260, z = 8},{x = 3689, y = 338, z = 8})
	local seventh_cave = getPlayersInArea({x = 3616, y = 270, z = 9},{x = 3680, y = 341, z = 9})
	local eight_cave = getPlayersInArea({x = 3445, y = 175, z = 6},{x = 3515, y = 241, z = 6})
	local ninth_cave = getPlayersInArea({x = 3445, y = 175, z = 5},{x = 3515, y = 241, z = 5})
	local tenth_cave = getPlayersInArea({x = 3445, y = 175, z = 4},{x = 3515, y = 241, z = 4})
	local eleventh_cave = getPlayersInArea({x = 3143, y = 342, z = 8},{x = 3246, y = 423, z = 8})
	local castle_area = getPlayersInArea(realCastle.frompos,realCastle.topos)
	if first_cave then
		for _, pid in pairs(first_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if second_cave then
		for _, pid in pairs(second_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if third_cave then
		for _, pid in pairs(third_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if fourth_cave then
		for _, pid in pairs(fourth_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2288 and pos.x <= 2364 and pos.y >= 433 and pos.y <= 509 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2148 and pos.x <= 2189 and pos.y >= 641 and pos.y <= 679 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2229 and pos.x <= 622 and pos.y >= 2320 and pos.y <= 704 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if fifith_cave then
		for _, pid in pairs(fifith_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if sixth_cave then
		for _, pid in pairs(sixth_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area10 then
		for _, pid in pairs(area10) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area11 then
		for _, pid in pairs(area11) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area12 then
		for _, pid in pairs(area12) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area13 then
		for _, pid in pairs(area13) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area14 then
		for _, pid in pairs(area14) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area15 then
		for _, pid in pairs(area15) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area16 then
		for _, pid in pairs(area16) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area17 then
		for _, pid in pairs(area17) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area18 then
		for _, pid in pairs(area18) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end

	if castle_area then
		for _, pid in pairs(castle_area) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
end

realCastle.open = function()
	setGlobalStorageValue(realCastle.open_storage,1)
	setGlobalStorageValue(realCastle.guild_storage,-1)
	realCastle.removePlayers()
end

realCastle.release = function()
	setGlobalStorageValue(realCastle.guild_storage,-1)
	realCastle.removePlayers()
end

realCastle.close = function()
	setGlobalStorageValue(realCastle.open_storage,-1)
	local tomorrow = getTomorrowsDate(getTomorrowsDate()[1])
	for i = 1,3 do
		setGlobalStorageValue(realCastle.date_storages[i],tomorrow[i])
	end
	local players = getPlayersInArea(realCastle.frompos, realCastle.topos)
	if players then
		for _, pid in pairs(players) do
			doTeleportThing(pid,getTownTemplePosition(1))
		end
	end
	if getGlobalStorageValue(realCastle.guild_storage) == -1 then
		doBroadcastMessage("[Alfa Castle] A batalha terminou e nenhuma guild conseguiu dominar o castelo! Amanhã às 22:00 vocês podem tentar novamente!")
	else
		doBroadcastMessage("[Alfa Castle] A batalha terminou e a guild vencedora foi "..getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)).."! Todos os jogadores dessa guild agora podem aproveitar o castelo até amanhâ às 22:00!")
	end
	doSaveServer()
end

realCastle.broadcast = function(message)
	local players = getPlayersInArea(realCastle.frompos, realCastle.topos)
	if players then
		for _, pid in pairs(players) do
			doPlayerSendTextMessage(pid,MESSAGE_STATUS_WARNING,message)
		end
	end
end

realCastle.domain = function(cid)
	local guild_id = getPlayerGuildId(cid)
	setGlobalStorageValue(realCastle.guild_storage,guild_id)
	realCastle.broadcast("[Castle] O jogador "..getPlayerName(cid).." da guild "..getPlayerGuildName(cid).." dominou o castelo! As outras guilds têm até às 23:00 para conseguir tirar o domínio deles, não desistam!")
end

realCastle.isDominating = function(cid)
	local guild_id = getPlayerGuildId(cid)
	return guild_id == getGlobalStorageValue(realCastle.guild_storage)
end

realCastle.isOpen = function()
	return getGlobalStorageValue(realCastle.open_storage) == 1
end

 

 

 

tenta mudar teu action pra esse:
 

Spoiler

function onUse(cid, item, frompos, item2, topos)
	if item.uid == 61466 then
		local guild = getGlobalStorageValue(realCastle.guild_storage) > 1 and "a guild "..getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)).." possui o domínio" or "nenhuma guild possui o domínio do castelo"
		local sto = realCastle.date_storages
		local gsto = getGlobalStorageValue
        local tm1, tm2, tm3 = gsto(sto[1]), gsto(sto[2]), gsto(sto[3])
        if (not tm1) then tm1 = 0 end
        if (not tm2) then tm2 = 0 end
        if (not tm3) then tm3 = 0 end
		local time = tm1.."/"..tm2.."/"..tm3
		local domain = realCastle.isOpen() and "as guilds estão batalhando pelo domínio do castelo" or guild
		local msg = " --------[Alfa Castle]-------\n\n\nAtualmente "..domain..".\n\nPróxima batalha: "..time.." às 22:00."
		doShowTextDialog(cid,8977,msg)
		return true
	end
	if not realCastle.isOpen() then 
		doTeleportThing(cid,getTownTemplePosition(1)) 
		return true 
	end
	if not realCastle.isDominating(cid) then
		realCastle.domain(cid)
		doSendMagicEffect(getThingPos(cid), CONST_ME_CRAPS)
	else
		doPlayerSendCancel(cid,"Sua guild já está com o domínio do castelo.")
	end
	return true
end

 

 

Em 31/03/2022 em 22:49, FeeTads disse:

ah então é só vc por isso: 
 


local gsto = getGlobalStorageValue(realCastle.dateStorages)

 
 

no lugar da gsto

 

na verdade, em lua, é possível instanciar as funções através das locais, e os paramêtros só são passados quando vc chama a função instanciada, como por exemplo:
 

	local rem = doRemoveCreature
	rem(cid)

 

Postado
  • Autor
Em 31/03/2022 em 22:49, FeeTads disse:

ah então é só vc por isso: 
 


local gsto = getGlobalStorageValue(realCastle.dateStorages)

 
 

no lugar da gsto

 

fiz o que falou mais o error continua

Em 02/04/2022 em 15:05, So volto tarde disse:

tenta mudar teu action pra esse:
 

  Mostrar conteúdo oculto


function onUse(cid, item, frompos, item2, topos)
	if item.uid == 61466 then
		local guild = getGlobalStorageValue(realCastle.guild_storage) > 1 and "a guild "..getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)).." possui o domínio" or "nenhuma guild possui o domínio do castelo"
		local sto = realCastle.date_storages
		local gsto = getGlobalStorageValue
        local tm1, tm2, tm3 = gsto(sto[1]), gsto(sto[2]), gsto(sto[3])
        if (not tm1) then tm1 = 0 end
        if (not tm2) then tm2 = 0 end
        if (not tm3) then tm3 = 0 end
		local time = tm1.."/"..tm2.."/"..tm3
		local domain = realCastle.isOpen() and "as guilds estão batalhando pelo domínio do castelo" or guild
		local msg = " --------[Alfa Castle]-------\n\n\nAtualmente "..domain..".\n\nPróxima batalha: "..time.." às 22:00."
		doShowTextDialog(cid,8977,msg)
		return true
	end
	if not realCastle.isOpen() then 
		doTeleportThing(cid,getTownTemplePosition(1)) 
		return true 
	end
	if not realCastle.isDominating(cid) then
		realCastle.domain(cid)
		doSendMagicEffect(getThingPos(cid), CONST_ME_CRAPS)
	else
		doPlayerSendCancel(cid,"Sua guild já está com o domínio do castelo.")
	end
	return true
end

 

 

na verdade, em lua, é possível instanciar as funções através das locais, e os paramêtros só são passados quando vc chama a função instanciada, como por exemplo:
 


	local rem = doRemoveCreature
	rem(cid)

 

puts cara obrigado mesmo, troquei a lua e deu certo, muito obrigado

agora quando o castle vai fechar aparece esse erro

 

[23:19:00.013] [Error - GlobalEvent Interface]
[23:19:00.016] data/globalevents/scripts/realCastle.lua:onTime
[23:19:00.019] Description:
[23:19:00.021] data/lib/realCastle.lua:156: attempt to call global 'getTomorrowsDate' (a nil value)
[23:19:00.022] stack traceback:
[23:19:00.025]  data/lib/realCastle.lua:156: in function 'close'
[23:19:00.027]  data/globalevents/scripts/realCastle.lua:22: in function <data/globalevents/scripts/realCastle.lua:20>
[23:19:00.031] [Error - GlobalEvents::timer] Couldn't execute event: Real Castle Close

 

Postado
Em 02/04/2022 em 15:05, So volto tarde disse:

setGlobalStorageValue(realCastle.open_storage,-1)
local tomorrow = getTomorrowsDate(getTomorrowsDate()[1])
for i = 1,3 do
         setGlobalStorageValue(realCastle.date_storages[i],tomorrow[i])
end

@vitinhoo96 eu meu castle eh um pouco diferente quando fecha, tenta assim
 

local tomorrow = getTomorrowsDate()
		local tomorrowString = tomorrow[1].."/"..tomorrow[2].."/"..tomorrow[3]
		for i = 1, 3 do
			setGlobalStorageValue(realCastle.dateStorages[i], tomorrow[i])
		end

 

Postado
  • Autor
2 horas atrás, FeeTads disse:

@vitinhoo96 eu meu castle eh um pouco diferente quando fecha, tenta assim
 



local tomorrow = getTomorrowsDate()
		local tomorrowString = tomorrow[1].."/"..tomorrow[2].."/"..tomorrow[3]
		for i = 1, 3 do
			setGlobalStorageValue(realCastle.dateStorages[i], tomorrow[i])
		end

 

Coloquei e apareceu esse outro erro, quando é pra fechar o castle.

[12:32:00.600] [Error - GlobalEvent Interface]
[12:32:00.602] data/globalevents/scripts/realCastle.lua:onTime
[12:32:00.605] Description:
[12:32:00.607] data/lib/realCastle.lua:155: attempt to call global 'getTomorrowsDate' (a nil value)
[12:32:00.608] stack traceback:
[12:32:00.609]  data/lib/realCastle.lua:155: in function 'close'
[12:32:00.611]  data/globalevents/scripts/realCastle.lua:22: in function <data/globalevents/scripts/realCastle.lua:20>
[12:32:00.612] [Error - GlobalEvents::timer] Couldn't execute event: Real Castle Close

 

 

aqui esta meu lib/realcastle

realCastle = {
	
	open_storage = 722374,
	guild_storage = 722375,
	date_storages = {722376,722377,722378},
	open_days = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Wednesday","Saturday"},
	frompos = {x = 2219, y = 293, z = 6},
	topos = {x = 2343, y = 388, z = 6}

}

realCastle.removePlayers = function()
	local first_cave = getPlayersInArea({x = 2829, y = 7, z = 7},{x = 3118, y = 467, z = 7})
	local second_cave = getPlayersInArea({x = 2902, y = 340, z = 7},{x = 3445, y = 585, z = 7})
	local fifith_cave = getPlayersInArea({x = 3304, y = 192, z = 7},{x = 3687, y = 340, z = 7})
	local sixth_cave = getPlayersInArea({x = 3595, y = 260, z = 8},{x = 3689, y = 338, z = 8})
	local seventh_cave = getPlayersInArea({x = 3616, y = 270, z = 9},{x = 3680, y = 341, z = 9})
	local eight_cave = getPlayersInArea({x = 3445, y = 175, z = 6},{x = 3515, y = 241, z = 6})
	local ninth_cave = getPlayersInArea({x = 3445, y = 175, z = 5},{x = 3515, y = 241, z = 5})
	local tenth_cave = getPlayersInArea({x = 3445, y = 175, z = 4},{x = 3515, y = 241, z = 4})
	local eleventh_cave = getPlayersInArea({x = 3143, y = 342, z = 8},{x = 3246, y = 423, z = 8})
	local castle_area = getPlayersInArea(realCastle.frompos,realCastle.topos)
	if first_cave then
		for _, pid in pairs(first_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if second_cave then
		for _, pid in pairs(second_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if third_cave then
		for _, pid in pairs(third_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if fourth_cave then
		for _, pid in pairs(fourth_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2288 and pos.x <= 2364 and pos.y >= 433 and pos.y <= 509 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2148 and pos.x <= 2189 and pos.y >= 641 and pos.y <= 679 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	for _, tid in pairs(getPlayersOnline()) do
		local pos = getThingPos(tid)
		if pos.x >= 2229 and pos.x <= 622 and pos.y >= 2320 and pos.y <= 704 then
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(tid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if fifith_cave then
		for _, pid in pairs(fifith_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if sixth_cave then
		for _, pid in pairs(sixth_cave) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area10 then
		for _, pid in pairs(area10) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area11 then
		for _, pid in pairs(area11) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area12 then
		for _, pid in pairs(area12) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area13 then
		for _, pid in pairs(area13) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area14 then
		for _, pid in pairs(area14) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area15 then
		for _, pid in pairs(area15) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area16 then
		for _, pid in pairs(area16) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area17 then
		for _, pid in pairs(area17) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
	if area18 then
		for _, pid in pairs(area18) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end

	if castle_area then
		for _, pid in pairs(castle_area) do
			doTeleportThing(pid,getTownTemplePosition(1))
			doPlayerPopupFYI(pid,"O domínio de sua guild sob o castelo acabou e uma nova batalha está se iniciando.")
		end
	end
end

realCastle.open = function()
	setGlobalStorageValue(realCastle.open_storage,1)
	setGlobalStorageValue(realCastle.guild_storage,-1)
	realCastle.removePlayers()
end

realCastle.release = function()
	setGlobalStorageValue(realCastle.guild_storage,-1)
	realCastle.removePlayers()
end

realCastle.close = function()
	local tomorrow = getTomorrowsDate()
		local tomorrowString = tomorrow[1].."/"..tomorrow[2].."/"..tomorrow[3]
		for i = 1, 3 do
			setGlobalStorageValue(realCastle.dateStorages[i], tomorrow[i])
		end
	local players = getPlayersInArea(realCastle.frompos, realCastle.topos)
	if players then
		for _, pid in pairs(players) do
			doTeleportThing(pid,getTownTemplePosition(1))
		end
	end
	if getGlobalStorageValue(realCastle.guild_storage) == -1 then
		doBroadcastMessage("[Raid Castle] A batalha terminou e nenhuma guild conseguiu dominar o castelo! Amanhã às 22:00 vocês podem tentar novamente!")
	else
		doBroadcastMessage("[Raid Castle] A batalha terminou e a guild vencedora foi "..getGuildNameByID(getGlobalStorageValue(realCastle.guild_storage)).."! Todos os jogadores dessa guild agora podem aproveitar o castelo até amanhâ às 22:00!")
	end
	doSaveServer()
end

realCastle.broadcast = function(message)
	local players = getPlayersInArea(realCastle.frompos, realCastle.topos)
	if players then
		for _, pid in pairs(players) do
			doPlayerSendTextMessage(pid,MESSAGE_STATUS_WARNING,message)
		end
	end
end

realCastle.domain = function(cid)
	local guild_id = getPlayerGuildId(cid)
	setGlobalStorageValue(realCastle.guild_storage,guild_id)
	realCastle.broadcast("[Raid Castle] O jogador "..getPlayerName(cid).." da guild "..getPlayerGuildName(cid).." dominou o castelo! As outras guilds têm até às 23:00 para conseguir tirar o domínio deles, não desistam!")
end

realCastle.isDominating = function(cid)
	local guild_id = getPlayerGuildId(cid)
	return guild_id == getGlobalStorageValue(realCastle.guild_storage)
end

realCastle.isOpen = function()
	return getGlobalStorageValue(realCastle.open_storage) == 1
end

 

Aqui o globalevents/scripts/realCastle

 

local function announce(message, times)
	if times == 0 then return true end
	doBroadcastMessage(message)
	addEvent(announce,5*60000,message,times - 1)
end

--[[function onTime()
	if not realCastle.isOpen() then
		announce("[Raid Castle] O acesso à área de dominar do castelo está liberado até as 20:00. Boa sorte a todas as guilds!",11)
		for i = 1,4 do
			addEvent(doBroadcastMessage,60000 * i,"[Raid Castle] O acesso à área de dominar do castelo está liberado até as 23:00. Boa sorte a todas as guilds!")
		end
		realCastle.open()
	else
		realCastle.close()
	end
    return true
end]]

function onTime()
	if realCastle.isOpen() then
		realCastle.close()
	else
		if isInArray(realCastle.open_days, os.date("%A")) then
			announce("[Alfa Castle] O acesso à área de dominar do castelo está liberado até as 23:00. Boa sorte a todas as guilds!",11)
			for i = 1,4 do
				addEvent(doBroadcastMessage,60000 * i,"[Raid Castle] O acesso à área de dominar do castelo está liberado até as 23:00. Boa sorte a todas as guilds!")
			end
			realCastle.open()
		else
			doBroadcastMessage("[Raid Castle] O castelo foi fechado para os plebeus poderem prepará-lo para a próxima batalha, que ocorrerá amanhã às 22:00!")
			realCastle.release()
		end
	end
	return true
end

 

Editado por vitinhoo96 (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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo