Pretty big difference between using a script to check health, changing it to check for mana, and a mp renewal mod <.<
But if that's what you wanted you'd have to get an app and find the hex code for the color of the mana that you have in the mana bar. Then you'd need to change lifebar[0] to the x coordinate of the first spot after the numerical text on the mana bar that has that color and then change lifebar[2] to the last x coordinate that can have that color in the mana bar.
If you were using this in a bot with the life check as well you'd need to change function and variable names for lifebar to like manabar or whatever.