Start from an EOS (equiation of state) and check for a point of inflection imposing the first and second derivative of p with respect to V (at constant temperature ) are equal to zero.....
Why would you want to calculate the critical pressure and temperature? These are experimentally determined parameters. Usually both of these are input values to the EOS, so using the EOS to determine the critical parameters seems to be a circular procedure. A bit of Googling will find these parameters very quickly for most substances.
If you can explain what substances you are working with, and why you need these parameters you will probably get better responses from the forum members.