You can also use key_hit for detecting the moment when the key is pressed down, thats in the keys.c library.

if(key_hit("a")) ....

is different to

if(key_a) ...

which is true as long as the key is pressed down.