If you're setting clientr.tempdmg client-side then the change isn't being seen serverside, therefore no damage is occurring.
Also update the chat when the baddy takes damage, not on a loop, that's very wasteful.
You can't 'timeout' faster than 0.1 seconds (and you should avoid doing so at all costs) on the server-side.
Try this:
PHP Code:
function onCreated() {
this.setshape(1, 32, 32);
this.setImg("block.png");
this.health = 500;
this.maxhealth = 500;
this.chat = this.health @ "/" @ this.maxhealth;
}
function onWasDmg() {
this.health -= 1;
this.chat = this.health @ "/" @ this.maxhealth;
}
If it works then you need to fix your weapon system that triggers 'WasDmg'.