Alguém me ajuda a otimizar essa function para otx 2.12, ela funciona porém ao roda a function o servidor "congela" e após a function completar sua verificação o servidor "descongela"
addEvent(function (removeMonsterInArea)
if not isCreature(cid) then
return
end
local positionsCheck = {}
for i = config.from.x, config.to.x do
positionsCheck[#positionsCheck+1] = {x=i, y = config.from.y, z = config.from.z, stackpos = 0}
for j = config.from.y+1, config.to.y do
positionsCheck[#positionsCheck+1] = {x=i, y = j, z = config.from.z, stackpos = 0}
end
end
for j=1, #positionsCheck do
for i = 0, 255 do
positionsCheck[j].stackpos = i
local tile = getTileThingByPos(positionsCheck[j])
if isMonster(tile.uid) then
doRemoveCreature(tile.uid)
end
end
end
return true
end, config.time*60*1000, cid)
Question
New'gadu 0
Alguém me ajuda a otimizar essa function para otx 2.12, ela funciona porém ao roda a function o servidor "congela" e após a function completar sua verificação o servidor "descongela"
addEvent(function (removeMonsterInArea) if not isCreature(cid) then return end local positionsCheck = {} for i = config.from.x, config.to.x do positionsCheck[#positionsCheck+1] = {x=i, y = config.from.y, z = config.from.z, stackpos = 0} for j = config.from.y+1, config.to.y do positionsCheck[#positionsCheck+1] = {x=i, y = j, z = config.from.z, stackpos = 0} end end for j=1, #positionsCheck do for i = 0, 255 do positionsCheck[j].stackpos = i local tile = getTileThingByPos(positionsCheck[j]) if isMonster(tile.uid) then doRemoveCreature(tile.uid) end end end return true end, config.time*60*1000, cid)
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now