I'm not a pro and idk if this will work
PHP Code:
function onKeyPressed(code, key){ if (key == "m") { //Open the map } else { //Close the map } }
|
Would close the map whenever you press any other key.
Maybe this could work. Itīs kinda late now and had a tough day but I gues this would work.
PHP Code:
function onKeyPressed(code, key) {
if (key != "m") return; //recently fell in love to use this way idk why
this.mapclosed = !this.mapclosed; //change the boolean (true/false)
if (this.mapclosed) startARandomFunctionToOpenTheMapOrTheActualScript();
else if (!this.mapclosed) closeTheMap();
}