string llKey2Name(key id)
If the object or agent identified by the key id is in the same simulator as the object containing the script, this function returns their name. Otherwise, an empty string ("") is returned. This can be misleading, because it cannot be distinguished from an object with an empty name (""). See llGetObjectDetails for a better function.
See llRequestAgentData for a (much slower) way to use the dataserver to get the name of an agent even outside the sim or offline.
Note: This function works if someone can see the sim from an adjacent sim. V1.9