Tbm não foi ;x
Vo colocar o script completo aqui para vcs tentarem
local THRONE_POS = {x = 561, y = 447, z = 5}
local STORAGE_EVENT = 83902
local STORAGE_PLAYER = 73289
local DUR = 1 -- in minutes
guildname = getPlayerGuildName(cid)
guild = getPlayerGuildId(cid)
function OpenEvent()
for _, tid in ipairs(getPlayersOnline()) do
setPlayerStorageValue(tid, STORAGE_PLAYER, 1)
end
setGlobalStorageValue(STORAGE_EVENT, 1)
doBroadcastMessage("[Castle Event] A guerra pelo castelo de Wisland iniciou, chame sua guild e va batalhar pelo castelo!",22)
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(100, 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. " ..getGuildName(player), 25)
doTeleportThing(player, {x = 531, y = 459, z = 7})
doRemoveItem(getThingFromPos({x = 541, y = 475, z = 6, stackpos = 1}).uid, 1)
doCreateItem(391, 1, {x = 561, y = 447, z = 5})
end
else
doBroadcastMessage("[Castle Event] Ninguem ganhou o evento, voce tem 1 minuto para sair do castelo, ou sera eliminado pelos guardioes.", 22)
for _, pid in ipairs(getPlayersOnline()) do
setPlayerStorageValue(pid, STORAGE_PLAYER, 0)
doRemoveItem(getThingFromPos({x = 541, y = 475, z = 6, stackpos = 1}).uid, 1)
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 = 53559, y = 474, z = 7}, 1285)
local escada = getTileItemById({ x = 53559, y = 474, z = 7}, 3687)
if pedra.uid > 0 then
return doRemoveItem(pedra.uid)
else
return doCreateItem(1285, 1, { x = 53559, y = 474, z = 7})
end
if escada.uid > 0 then
return doRemoveItem(escada.uid)
else
return doCreateItem(3687, 1, {x = 55539, y = 474, z = 7})
end
end
function onSay(cid, words, param, channel)
if ((param == "abrir") and (getGlobalStorageValue(STORAGE_EVENT) == 1)) then
doPlayerSendTextMessage(cid, 27, "O evento já esta aberto.") return true
elseif ((param == "fechar") and (getGlobalStorageValue(STORAGE_EVENT) == 1)) then
getWinnerCastle()
CastleWalls()
return true
end
doCreateItem(3687, 1, {x = 55539, y = 474, z = 7})
OpenEvent()
CastleWalls()
addEvent(getWinnerCastle, DUR * 60 * 1000)
return true
end