For unreal-ircd with anope services, if -your- nick has a vhost assigned (has to be manually set by an admin/host setter) then the network will notice you with the following text:
-HostServ- Your vhost of [vhost] is now activated.
Note, [vhost] is whatever your vhost is, and without brackets.
Just do an on:notice event and have it look for 'Your vhost of' being sent by 'HostServ' then set your %variable to $true or $false.
Now, to determine if a user other then yourself is using a vhost.. its fairly easy. Just look for usermode +x set to the user. (For unreal-ircd that is) This indicates that either the user is using a vhost, OR has their ip/host masked via ip encryption.
You can use this method to check yourself for a vhost.. but, it could return true even without a vhost. (It will return true because encryption and vhost share the same mode) This is why it would be best to check for a notice from hostserv, then you're sure your vhost is on and not just standard ip encryption.
For other ircds.. i wouldn't know :p I only admin an unreal-ircd network, and connect to them. I've never been on dal/ef/quake or the other much larger networks that use different ircds :p Though, if they have someway to encrypt a user's ip address, im sure its marked via a usermode.