Usually if you died shooting, you're still sending the "shoot a bullet plz" packet to the server, but the server can't do anything since you died. Then when you respawn, the server says "Ok, minus one bullet since you're alive now." and fires a bullet. There's really no way to get around this, except to stop shooting right before you die.