Environment Samples - Player Detection

The sample code below provides a basic example on how player detection is possible using the Environment objects.

// Environment Samples - Player Detection

function onEnter(living) {
    if (living.isPlayer) {
        this.sendMessageTo(living, 'Welcome');
    }
}

function onLeave(living) {
    if (living.isPlayer) {
        this.sendMessageTo(living, 'Goodbye');
    }
}