This is like a 'state' situation. Hint: Set up a state variable (e.g. e_state=1) so that when the player presses the desired key to run e.g. E key , then use SetCharacterToRun(entity index). Then change the state variable to 0 e.g. e_state=0, when the player presses E again and then use SetCharacterToWalk(entity index) or whatever the desired animation is you want. That is just the very basic foundation for the code, you will probably need to do more.
I think this is what you mean, but please correct me if I'm wrong.
Professional Programmer: Languages- SAS, C++, SQL, PL-SQL, JavaScript, HTML, Darkbasic Pro, Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; LG TFT monitor (widescreen).