CREATE YOUR WORLD
Multiplay
Temporarily Restricting Room Access in Multiplay
4min
you can use the lock, unlock function to restrict or allow room access at your desired timing 📘 please refer to the following guide \[ zepeto multiplay(server) api https //developer zepeto me/docs/multiplay server/classes/zepeto multiplay sandbox#lock ] lock the lock function is a function restricts room access await this lock(); unlock the unlock function is a function that allows room access but, if the number of people who are currently connected is the same as the maximum number of people allowed in the room, the room cannot be unlocked await this unlock(); example the following is an example code that uses the lock and unlock functions import { sandbox, sandboxoptions, sandboxplayer } from 'zepeto multiplay'; export default class extends sandbox { oncreate(options sandboxoptions) { } async onjoin(client sandboxplayer) { try { if (this clients length > 8) { await this lock(); } } catch(e) { console error(e); } } async onleave(client sandboxplayer, consented? boolean){ try { if (this clients length <= 8) { await this unlock(); } } catch(e) { console error(e); } } } 👍 difference between lock and private functions the locked multiplayer room is not visible in the zepeto room list and cannot be entered by invitation private multiplayer rooms are not shown in the list of zepeto rooms, but invitations are acceptable