function DetectPawns(nameorids) cprintf(cli.yellow,"Pawn Detector running. Press <%s> to stop the detector.\n",getKeyName(settings.hotkeys.START_BOT.key)) if type(nameorids) == "string" or type(nameorids) == "number" then nameorids = {nameorids} end local obj = nil; local objectList repeat player:update() objectList = CObjectList(); objectList:update(); local found = false for i = 0,objectList:size() do obj = objectList:getObject(i); if( obj ~= nil ) then for __,nameid in pairs(nameorids) do if obj.Id == nameid or string.find(string.lower(obj.Name),string.lower(nameid),1,true) then local npcdist = distance(player.X,player.Z,player.Y,obj.X,obj.Z,obj.Y) print(obj.Name .. " detected. Distance \a"..npcdist) if npcdist < 50 then npcdist = 50 end yrest(npcdist*4) found = true end end end end if not found then yrest(500) end until keyPressedLocal(settings.hotkeys.START_BOT.key) end