Recreating 3D Shooter Template, Player doesn't stop moving

I saw the 3D Shooter Game template made by Captain Oblivion, and since I’m making a 3D platformer sort of game I thought it’d be a useful resource to base my character movement around. I got to work recreating it, retyping most of it exactly, but making my own changes as well. I changed the way the script handles keyboard/mouse inputs because Captain’s wasn’t working for some reason, but other than that it’s been pretty minor changes like names of variables. All the math is the same, but strangely when the player starts moving, he doesn’t stop. Ever. You can change direction, but you can’t stop moving. I have no clue why this would be, and I’m still pretty new to programming so I 'm not sure what the problem is. Oh, and I’m using a modified version of Mobius’s 3rd person camera too, but that shouldn’t affect this.

Blend File:

The script that the problem is in is called Control and I think it’ll be open when you open the .blend file
Thanks in advance!

Wow, I feel like an idiot. I fixed this IMMEDIATELY after posting this, I typed out an equation wrong. Sorry guys, can I take this down somehow?

Well I guess it could stay up because now I have another question; I tried to make the character rotate to the direction the camera is facing by getting both of their orientation and setting the z of the player to the camera’s but when I run it and press w to go forward the camera spins around in a circle. The player does change his orientation, but not in a predictable way and possibly not even to the camera. The lines in question are 24-28 and 85-87.

Blend File: