Not very kind of you trying to attack someone you are at the same time offering a truce.

This said, technically you cannot attack a player you're offering a truce but you can by-pass this by withdrawing your offer, doing your evil attack and issuing the NAP offer again.
Or is it the other way around, someone offering a truce to you? Same logic: reject the offer, attack and if you want to have this truce "on second thought", you can issue the NAP from your side after the attack and hope the other player rejects and counter-offers a truce and wants to give you all his cities and gold till the end of time.
