Issues with yours:
Can remove the speed controls for player, BABS already handles that
SP will drain even if player is standing still, there is no check to make sure the player is MOVING while the run key is pressed.
Player can still run when SP reaches zero.
SP does regen even after it hits zero, but it don't matter as there isn't any check to disable run when it hits zero.
SO regens very fast, even if running was disabled, you could tap the key or hold it down to a jiddery but still faster speed.
Heres what I have pretty much.
Yellow part is the issue. It's what tells it if SP is at or below whatever value, disable run, so you can not run at all, else, turn running back on.
The rest of it checks if the direction key and if you are running are on. is so drain sp, if not slowly regen. This way SP wont just drain even if you're standing still have have the run key held.
the issue is with the disable check, the part marked in yellow. WITH IT if you run and stop WITH OUT fully draining sp, it will regen just fine. IF you drain it fully, to what ever value you have it set, SP will not regen at all.
Yet with out it, so can drain to zero, and fully regen, but the play can run all the time, because there is nothing to tell them not to.
I made a topic about this way back in 10. x.x
edit: yep heres the OLLDDDDD topic.
http://forum.chaos-project.com/index.php/topic,7766.0.htmlI gave up on it, as nothing was really helping and people were not grasping what my issue was and trying to offer fix's for things I wasn't having issues with.
if you wish to resume, do it there I guess, so we arn't taking over this fellas topic
didn't mean to.