is there codes to attack ppl
Well, there's Bushido (http://en.wikipedia.org/wiki/Bushido) ;)
Short answer: No.
Long answer: What do you want to happen if an NPC is attacked? Will they loose HP? Will they disappear?
Elaborate, or we can't help you at all.
(I was *really* tempted to write a rude answer here, but I'm in a good mood.)
There were two Coding Contests that generated entries you might be able to use (this one (http://americangirlscouts.org/agswiki/Coding_Contest#Fight_game) and this one (http://americangirlscouts.org/agswiki/Coding_Contest#Turn-based_battle)). Because of how old they are, they might not work without a bit of rewriting, but take a look at the for yourself. A forum search may turn up more, as well - you're not the first person to ask this.
Beyond that, what Khris said. You need to be more clear about what you want to happen. There's no in-built way to handle it, it's not really what AGS is for, but it can be done if your willing to code it. Look at the Coding Contest examples, think about what you want to happen, try to figure it out for yourself, then post back here when you've got more specific questions.