resting is set just like in that script and its up to 90% not 100% and the bug only happends on one of the characters that is what is so weird i never had it to 100%
edit:
added an image so you can see whats going on

As you see, MP is 87% (in bot), because bot couldn't receive full mp packet and that's why it doesn't log out. Set mp rest value to 80-85%.