This follows from Frobenius reciprocity for compact induction. Let $G$ be the group of rational points of a reductive $p$-adic group and $K$ be a compact open subgroup of $G$. Then if $\lambda$ is any smooth representationf of $K$, we denote by ${\rm ind}_K^G \lambda$ the compactly induced representation. Then by Frobenius reciprocity, the functors ${\rm Hom}_G ({\rm ind}_K^G \lambda , -)$
and ${\rm Hom}_K (\lambda ,-)$ are isomorphic. It follows, by definition of projectivity, that ${\rm ind}_K^G \lambda$ is projective since $\lambda$ is projective as a $K$-module. Indeed any smooth representation of $K$ is semisimple.
The result remains true if $K$ is compact mod the center of G and $\lambda$ has a central character $\chi$ provided that you work with the category ${\rm S}_\chi (G)$ of smooth representations of $G$ with central character $\chi$.
It is also known that irreducible supercuspidal representations of $G$ with central character $\chi$ are projective (and injective) objects of the category $S_\chi (G)$. [Adler and Roche,
Injectivity, Projectivity and Supercuspidal Representations J. London Math. Soc. (2004) 70 (2): 356-368] By the way the converse is true : if an object of $S_\chi (G)$ is projective and injective then it is supercuspidal.