For guns you would want something like this:
PHP Code:
function onTimeOut()
{
temp.k = keydown2( getKeyCode( "s" ), true );
if ( temp.k )
{
if ( ! this.isKeyPressed )
{
// the key is not being held down; has been pressed once.
}
else
{
// the key is being held down; not just pressed once.
}
}
this.isKeyPressed = temp.k;
setTimer( 0.05 );
}
Just an example.