Yes, as far as I can see it is not MP compatible (since it assumes that only the local player can have a name), whereas in an MP game, any player can have a name. Simplest fix for that is just to replace:
if (_this == player) then {if(format ["%1",_this] == format["%1:%2 (%3)", _grp, _i, name _this]) then {_ret = true;};};
with:
if (isPlayer _this) then {if(format ["%1",_this] == format["%1:%2 (%3)", _grp, _i, name _this]) then {_ret = true;};};
If it still causes problems with AI with identities set (not used them myself, so I can't say whether it would), just use:
if(format ["%1",_this] == format["%1:%2 (%3)", _grp, _i, name _this]) then {_ret = true;};
In case it wasn't obvious, you might need to increase the "13" in "while {!_ret AND _i <= 13} do" to a higher number, since that limits the result to 1 to 12 (i.e. 12-man groups).
**EDIT**
Actually, what that actually does is limit the number to 1 to 14 (14-man groups) in ArmA, but that wasn't an issue in OFP so the faulty logic wasn't an problem!