In Worms 4, the sentry gun is unlocked by finding it in a collectible crate, or by using the Kitchen Sink scheme. Either route will add it to your available weapons, so keep an eye out for those crates as you play.