Device_KeypadActivated
Skip to content
mnscript
Device_KeypadActivated(KeypadDevice, Player, bool, number) 

Description ​

Invoked when a connected Keypad device is activated

Arguments ​

KeypadDevice - The KeypadDevice which was activated
Player - The Player who activated the Keypad
bool - Whether the passcode was correct or incorrect
number - The passcode which was entered

Example ​

msc
using Console;
using Event;
using Player;
using Util;
using Device;

function OnKeypadActivated(KeypadDevice keypad, Player player, bool wasCorrect, number keycode){
    Console.WriteLine(player.GetName().." entered the keypad code: "..Util.ToString(keycode));
    
    if(wasCorrect){
        Console.WriteLine("The code was correct!");
    }else{
        Console.WriteLine("The code was wrong!");
    }
}

Event.AddListener("Device_KeypadActivated", "keypads", "OnKeypadActivated");