%targ1.player.getposition(%xA %yA %zA);
%targ2.player.getposition(%xB %yB %zB);
You don't need a package for any of this. The fact that you have three variables right next to each other is what's causing the (first) syntax error. Additionally, getPosition() has no arguments, so any variables there won't do anything. You also have parantheses around name, but name on a client is a function, not a variable. You are trying to get the position of the player of a string of text, which will not work since clients are not named like they were in v002. Additionally, you did not check if the clients and their players existed, which will cause console errors if a nonexistant client/player is targeted.
You cannot use carrots for exponents, you have to actually multiply the numbers. Use vectorDist like Resonance said.
Here's a working code.
function serverCmdDistance(%client, %targ1, %targ2)
{
if(%client.isadmin)
{
%targ1=findClientByName(%targ1);
%targ2=findClientByName(%targ2);
if(isObject(%targ1.player) && isObject(%targ2.player))
{
%pos1 = %targ1.player.getposition();
%pos2 = %targ2.player.getposition();
}
%dist = vectorDist(%pos1, %pos2);
messageClient(%client, '', "\c2The distance between \c3" @ %targ1.name @ "\c2 and \c3" @ %targ2.name @ "\c2 is: \c3" @ %dist @ "\c2.");
}
}