PHP Code:
//#CLIENTSIDE
function onPlayerChats() {
if(player.chat == "/hurtme") {
player.hearts--;
}
}
I'm only going to post an example, because you should learn how to do this yourself, instead of asking for other people to write the script for you. :P
The above will subtract 1 heart from the player every time they say
/hurtme. But, as Excalibur said, you'll want a custom system if you're using custom GANIs for weapons.