function SiegeBuffs() local playerX, playerY, playerZ = player.X, player.Y, player.Z local buffedTable = {} local buffThem = true while(true) do local objectList = CObjectList() objectList:update() local objSize = objectList:size() for i = 0,objSize do local obj = objectList:getObject(i) local distance = distance(player.X, player.Z, obj.X ,obj.Z) if player.Y >= (obj.Y - 50) and obj.Y >= (player.Y - 50) and 100 > distance and obj.Type == PT_PLAYER then if buffedTable[1] == "" or buffedTable[1] == nil then buffThem = true end for k,v in pairs(buffedTable) do if obj.Name == v or obj.Name == player.Name then buffThem = false break else buffThem = true end end if buffThem then yrest(200); player:target(obj) player:update(); if (player:haveTarget() ~= nil) then player:update(); local target = player:getTarget() target:update() target:updateBuffs() player:checkSkills(true) player:checkPotions() table.insert(buffedTable, obj.Name) end end end end for l,b in pairs(buffedTable) do local foundPlayer = player:findNearestNameOrId(""..b.."") if foundPlayer then local distance = distance(foundPlayer.X, foundPlayer.Z, player.X ,player.Z) if distance > 100 then if b ~= player.Name then table.remove(buffedTable, l) end end else if b ~= player.Name then table.remove(buffedTable, l) end end end player:update(); if distance(playerX,playerZ, player.X, player.Z) > 50 then player:moveTo(CWaypoint(playerX,playerZ,playerY), true) end end end