I need help in this script, all function work perfectly but function for remove Enemies don't work
unsing tfs 1.2 10.99
Globalents
Lib
unsing tfs 1.2 10.99
Globalents
Lua:
function onTime()
Game.broadcastMessage("[Castle Of Honor] Castle is open! All guilds have 1 HOUR to dominate it, after that it will be closed again and opened only in 24hrs!", MESSAGE_EVENT_ADVANCE)
Game.createItem(469, 1, Position(6260, 6744, 7))
addEvent(COH, 2 * 60 * 1000)
end
function COH()
Game.broadcastMessage("[Castle Of Honor] Closed!", MESSAGE_EVENT_ADVANCE)
local gatepos = {x=6260, y=6744, z=7, stackpos=1}
local getgate = getTileItemById(gatepos, 469)
doRemoveItem(getgate.uid,1)
Game.createItem(4532, 1, Position(6260, 6744, 7))
doCastleRemoveEnemies()
end
Lib
Lua:
COH_PUSHTIME = 10800
COH_AREA = {{x = 6371, y = 6592, z = 7}, {x = 6394, y = 6636, z = 7}}
COH_STATUS = 201320111714
COH_PREPARE1 = 201320111715
COH_PUSHSTOR = 201320111716
COH_PREPARE2 = 201320111717
function doCastleRemoveEnemies()
for index, player in ipairs(Game.getPlayers()) do
if isInRange(player:getPosition(), COH_AREA[1], COH_AREA[2]) then
local guild = player:getGuild()
if guild and guild:getName() ~= Game.getStorageValue(COH_STATUS) then
player:teleportTo(player:getTown():getTemplePosition())
end
end
end
return true
end