The best thing I can think of is to throw a box search straight down to see if they're over a baseplate that designates a building, something like this:
function player::isInBuilding(%this)
{
initContainerBoxSearch(vectorSub(%this.getHackPosition(),"0 0 50"), "0.5 0.5 100", $TypeMasks::fxBrickObjectType);
while(isObject(%i = containerSearchNext()))
if(%i.getDatablock().getName() $= "BuildingMarkerData")
return 1;
return 0;
}