Many ways to do this, but adding a boolean variable CarryingPistol to your playerand setting it to true on collision with pistol might be easiest:
add subevents to the keyboard is down events
subevent1
-player is boolean set carryingpistol - set animation to Playerpistol
subevent2
-else set animation to default