PS3 controller sometimes works, sometimes doesn't

So, I recently got a used PS3, controller and 3 games. I’ve used the controller on Steam, and with emulators, and it works perfectly. It also works perfectly on the PS3 menu. and with COD MW. However, in some parts of GTA IV, and FF XIII, the buttons don’t work at all. I can fix it in FF XIII by resetting the controller, it’s annoying, but it works. No matter what I do though, some parts of GTA IV are completely unplayable, like the pool minigame, and the taxis. Has anyone ever seen something like this before? I don’t know what’s to blame, the controller, console, or games.