There is no cheat code to get a tank in GTA 5. To get the tank, you need to go to the military base in Fort Zancudo. Enter with your car but since it is a restricted zone, your wanted level will rise to 4 stars.