Npc's death upon touching water

Can someone make me a five second script (serverside) that makes it so when any NPC in the server touches water they die? It would be greatly appreciated. THANKS IN ADVANCE!

Untested, but it should work
[lua]
function NPCWaterDeath()
for k, npc in pairs(ents.FindByClass(“npc_*”)) do
if npc:WaterLevel() > 0 then
npc:SetHealth(0)
end
end
end

hook.Add(“Think”, “NPCWaterDeath”, NPCWaterDeath)
[/lua]

I would do it on Tick