Eu sei que o War OF Emperium é um castle automatico, que acontece em dias e horarios que vc define... Quanto a esse seu castle eu não sei não, mas pode ser que alguém consiga fazer isso...
- Fórum
- xTibia - Notícias e Suporte
- Soluções
- Archived
- HELP WAR CASTLE AUTOMATICO
info
Grupo: Herói
Registrado: 01/05/08
Posts: 2.6k
Reputação: +536
Gênero: Masculino

Vá em data/globalevents/globalevents.xml e adicione a seguinte tag:
<globalevent name="autoEvent" interval="50000" event="script" value="evento.lua"/>Agora vá em data/globalevents/scripts, crie um arquivo chamado evento.lua com o seguinte conteúdo:
--[[
Segunda-feira - monday
Terça-feira - tuesday
Quarta-feira - wednesday
Quinta-feira - thursday
Sexta-feira - friday
Sábado - saturday
Domingo - sunday
** Vale lembrar que o horário é baseado no horário do servidor que o OT está rodando
]]
local config = {
days = {'monday', 'wednesday', 'friday', 'sunday'},
hour = 18,
minu = 00
}
local THRONE_POS = {x = 561, y = 446, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 10 -- in minutes
function OpenEvent()
for _, tid in ipairs(getPlayersOnline()) do
setPlayerStorageValue(tid, STORAGE_PLAYER, 1)
end
setGlobalStorageValue(STORAGE_EVENT, 1)
doBroadcastMessage("O Evento castle foi aberto.", 25)
end
function getWinnerCastle(cid)
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
pid = getPlayerGUID(cid)
setHouseOwner(6258, 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 = 531, y = 460, z = 7})
doCreateItem(391, 1, {x = 500, y = 500, z = 7})
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 CastleWalls()
local pedra = getTileItemById({ x = 539, y = 474, z = 7}, 1285)
local escada = getTileItemById({ x = 539, y = 474, z = 7}, 3687)
if pedra.uid > 0 then
return doRemoveItem(pedra.uid)
else
return doCreateItem(1285, 1, { x = 500, y = 500, z = 7})
end
if escada.uid > 0 then
return doRemoveItem(escada.uid)
else
return doCreateItem(3687, 1, {x = 500, y = 500, z = 7})
end
end
function onThink(interval, lastExecution, thinkInterval)
for _, b in ipairs(config) do
local day = os.date("%A", static_time):lower()
if isInArray(b.days, day) then
local hour = tonumber(os.date("%H", static_time))
if b.hour == hour then
local minute = tonumber(os.date("%M", static_time))
if b.minu == minute then
doCreateItem(3687, 1, {x = 500, y = 500, z = 7})
OpenEvent()
CastleWalls()
addEvent(getWinnerCastle, DUR * 60 * 1000)
end
end
end
end
return true
end
Seu script está configura para abrir todos os dias as 18h00 (horário do servidor).
Editado Julho 16 por Bruno Minervino
info
Grupo: Campones
Registrado: 09/07/15
Posts: 27
Reputação: 0

ok vou testa jaja falo se foi resolvido ![]()
[16/07/2015 02:31:37] [Error - GlobalEvents::think] Couldn't execute event: evento
me salva ae pliz e se tem como coloca segunta ,quarta ,sexta ,doming0
Editado Julho 16 por mczx4ndinho
info
Grupo: Herói
Registrado: 01/05/08
Posts: 2.6k
Reputação: +536
Gênero: Masculino

ok vou testa jaja falo se foi resolvido
[16/07/2015 02:31:37] [Error - GlobalEvents::think] Couldn't execute event: evento
me salva ae pliz e se tem como coloca segunta ,quarta ,sexta ,domingo
Refaz os procedimentos...
Alterei conforme sua solicitação, muda a tag xml também.




info
Grupo: Campones
Registrado: 09/07/15
Posts: 27
Reputação: 0
Queria Saber se esse script da pra deixa automatico \/
SE TIVER COMO COLOCA TAG TB PLIZ