Cześć
Chciałbym przerobić funkcję, żeby sprawdzała czy jest dany item w obrębie, ale nie wiem jak się do tego zabrać.
Mam funkcję która sprawdza czy jest jakiś gracz, potwór i chciałbym z niej właśnie skorzystać.
Przykład jak powinno być po przerobieniu
Dzięki.
Chciałbym przerobić funkcję, żeby sprawdzała czy jest dany item w obrębie, ale nie wiem jak się do tego zabrać.
Mam funkcję która sprawdza czy jest jakiś gracz, potwór i chciałbym z niej właśnie skorzystać.
Code:
function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
local creaturesList = {}
for x = -radiusx, radiusx do
for y = -radiusy, radiusy do
if not (x == 0 and y == 0) then
local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
table.insert(creaturesList, creature.uid)
end
end
end
end
local creature = getTopCreature(position)
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
if not(table.find(creaturesList, creature.uid)) then
table.insert(creaturesList, creature.uid)
end
end
return creaturesList
end
Przykład jak powinno być po przerobieniu
Code:
if getItemsInRange(pozycja xyz, 2, 2, 1387) == TRUE then
Dzięki.