Well, you press the certain key, remove the item, play a sound effect, etc. You could then have a variable for your character... for instance,
obj_character.has_gun = true.
How do I attach the weapon sprite to the character sprite
There are several ways. I think the easiest is to simply make a separate sprite(s) for your character when holding the weapon. However, if you have a lot of different-looking weapons and a lot of sprites for your character that would need to adjust, it's probably better to draw the weapon separately. You could create a special sprite of each weapon when it is being held by the character. Make a copy of your character sprite, draw the weapon on the sprite, and then erase the character part. Then in your character Draw event, you would have something like this:
Code:
draw_self()
if has_gun = true
draw_sprite(sprite_gun_held,0,x,y)
I hope that helps!