the latter addon appears to be easy to make
the title addon can be done with a bunch of copypasta. take a look at the sport rifle.cs, all the way at the bottom:
function SportRifleWeakProjectile::damage(%this,%obj,%col,%fade,%pos,%normal)
{
if(%this.directDamage <= 0)
return;
%damageType = $DamageType::Direct;
if(%this.DirectDamageType)
%damageType = %this.DirectDamageType;
%scale = getWord(%obj.getScale(), 2);
%directDamage = 24;
%damage = %directDamage;
%sobj = %obj.sourceObject;
if(%sobj.getType() & $TypeMasks::PlayerObjectType)
{
if(isObject(%sobj.client))
%sobj.client.play2d(bulletHitSound);
}
if(%col.getType() & $TypeMasks::PlayerObjectType)
{
%colscale = getWord(%col.getScale(),2);
if(getword(%pos, 2) > getword(%col.getWorldBoxCenter(), 2) - 3.3*%colscale)
{
%directDamage = %directDamage * 2;
%damageType = $DamageType::SportRifleHeadshot;
%col.spawnExplosion(critProjectile,%colscale);
if(isObject(%col.client))
%col.client.play2d(critRecieveSound);
if(%sobj.getType() & $TypeMasks::PlayerObjectType)
{
serverplay3d(critFireSound,%sobj.getHackPosition());
if(isObject(%sobj.client))
%sobj.client.play2d(critHitSound);
}
}
%col.damage(%obj, %pos, %directDamage, %damageType);
}
else
{
%col.damage(%obj, %pos, %directDamage, %damageType);
}
}
Just copy-paste that into any bullet weapon you want to have critical hits for, then replace "SportRifleWeakProjectile" with the projectile the gun is shooting (ex: GunProjectile). Adjust the critical hit bonus damage in the line %directdamage = %directdamage * 2; by changing 2 to some other value.
Make sure CritHitSound and CritReceiveSound and CritProjectile are existing datablocks - if you have any weapon with criticals enabled these datablocks should exist; otherwise, copy-paste the datablocks from them into your custom weapon (which you should do if you are releasing this so you don't have dependencies)