It depends on how you handle collision, ideally you want to know if the player is already in the air or if they are touching the ground. Any jump routine tends to involve physics, and that means you need velocity variables for your player, hopefully you already have that. The Y velocity should decrease over time, and if the player collides then that can be set to a small negative number, it's not always good to set it to 0, better to keep it hitting the collision.
So you need to have X Y and Z velocity, or just X and Y for 2D, and apply these to the player position, and adjust them for gravity and player control. If you detect a collision then there are different methods, but an easy example would be a matrix or terrain, where there's usually a convenient command to return the ground height.
Then, if the player is touching the ground, and the jump button is pressed, you set the Y velocity to a positive number, which sends the player up in a nice arc, as the Y velocity is reduced to negatives as gravity takes over.
Lots of factors involved, probably best to give more details or post code.
The code is dark and full of errors