The cycle plugin takes autostop
as an option parameter...
Just pass in the specified parameter....assuming 5 is the amount of slides you wanna stop at...
$(function(){
$('#slider').cycle({autostop:5});
});
Plugins usually allow various options, and its good to refer to the documentation when trying to modify settings.
You can see a list of all available options for this Cycle plugin here...