• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

remove creatures of area

foxkbt

Member
Joined
Sep 29, 2009
Messages
290
Reaction score
7
Location
Salvador
i need one function that remove creatures from certain area
i try that but dosent work
someone can help me?
PHP:
function removeRaid(fromPos, toPos)
local pos = fromPos
	for x=0,getDistanceBetween(fromPos, {x = toPos.x,y = fromPos.y,z=fromPos.z}) do
		for y=0,getDistanceBetween(fromPos, {x = fromPos.x,y = toPos.y,z=fromPos.z}) do
			pos = {x=fromPos.x+x,y=fromPos.y+y,z=fromPos.z}
		end
	end
	for _, pid in ipairs(getTopCreature(pos)) do
		if isInRange(getCreaturePosition(pid), fromPos, toPos) then
			doRemoveCreature(pid)
		end
	end
end
 
dosent work
change for that...
PHP:
function removeRaid(fromPos, toPos)
local t = {}
	for x=fromPos.x,toPos.x do
		for y=fromPos.y,toPos.y do
			local v = getTopCreature({x=x, y=y, z=7}).uid
			if isMonster(v) then
				table.insert(t, v)
			end
		end
	end
	for i = 1, #t do
		doRemoveCreature(t[i])
	end
end
 
Back
Top