I would use player::damage(%this, %obj, %sourceObject, %position, %damage, %damageType) depending on the situation.
%obj is the player.
%sourceObject is the player who fired it.
%position is for where it hits (Always going to be body)
%damage is the damage they receive, which can easily be modified for damage reduction / critical hits,
%damageType fetches the damage type.
I'm positive this function also works with AIPlayers.