That's what the circuit I showed in post #15 did......................
I see, that must be the problem i had with the voltage not being enough for powering a regulator (since the output voltage will be the set voltage of the opamp, in this case 0 - 3v. What do you recommend i do to make it not depend on the load resistance? Or so that i get enough voltage to power a regulator. Regards.
Below is your circuit of post #35 inverted to drive a grounded load.
It requires a rail-rail type op amp to work at the positive rail.
It uses a TL431a 2.5V reference to supply the limit control voltage (0 to minus 0.3V @ op amp input referenced to the positive rail).
You can substitute a PNP darlington stage for the P-MOSFET if you like.

