Bind a key to this command "impulse 101"
Example: bind "o" "impulse 101"
Basically just use it whenever you need ammo or health, if you want it to work with Jarate, Sandman Ball etc... Then just keep SPAMMING the binded key while SPAMMING the left mouse or right mouse button! Hope this helped!
P.S: And there are always mods to do that, so google it if you need one but I'm giving you the direct answer here.