If the situation of your stye is not serious, it is okay to hang out with your friends, but you should avoid play games in gym, because unclean hands could make the stye become worse. Washing your hands frequently and avoid rubbing your eyes by hands, and if you have to rub your eyes, use a clean towel instead of hands.
You'd better not go to the gym with a stye which will make it get more serious. You need to play after you get the recovery of the eyes. You could use the eye drops to moisture the eyes. You could also use the warm compress to make your eyes feel comfortable. You should also have the good rest for the eyes.
You can exercise despite of the stye in your eyes, but not in the gym. You should take the exercise at home to avoid spread Staphylococcal bacteria which are the cause of stye to other people. Your sweat on the equipment can cause stye in other people because there are contagious bacteria in the watery discharge. You can also spread the bacteria by just touching anything after direct contact with the eye with styes. It is not favorable to do exercise outside your home because styes cause sensitivity to light which prevents you from performing well. Your exercise should not be heavy, or it will reduce the resistance of your body to the infection.