I could be a very different person with my friends( a good one that i always remind them of islam) but when I am not with them,i am not that way,how do I prevent it
That’s natural. Abu Bakr and another companion (may God be pleased with them) complained to the Prophet ﷺ that they felt very spiritual in his presence, but when they were away from him, they started to feel unspiritual and concerned with the worldly life rather than the afterlife. The Prophet ﷺ said this is the natural state of humans.
What you can do is read beneficial books in your alone time, listen to beneficial lectures, read the Quran and worship. You can also spend your time doing things you enjoy, such as a hobby, since Islam does not require you to spend all of your time in worship.
Once you can avoid sins small and great and are able to perform all of the recommended voluntary prayers, then you have reached the proper state of faith and spirituality, and from there on you can spend some of your time seeking knowledge and the rest of it doing things you enjoy.