That would kill every Add-On every that uses Armor::onNewDatablock. Package it. Check whether it's even your King player.
Check whether it's even your King player.
if(%armor.getType(King)){function Armor::OnNewDatablock(%this,%obj){ parent::onAdd(%this,%obj); %obj.mountimage(Crownimage,2);}}
You can't declare a function within an if statement like that.