Studio GuideWorld SDK Guide
Log In

Setting in Private Room runtime

You can change the multiplayer Room attribute at runtime.

❗️

Caution

  • Please create the server code index.ts Sandbox.

Function definition

SetPrivate(isPrivate : boolean) : Promise - True : Set to private room
- False : Set to public room

📘

Please refer to the following guide. [ZEPETO.Multiplay(Server) API]


Example of use

import { Sandbox, SandboxOptions, SandboxPlayer } from 'ZEPETO.Multiplay';

export default class extends Sandbox {
    
    onCreate(options: SandboxOptions) {
        this.onMessage("SetPrivate", (client: SandboxPlayer, value: boolean) => {
            console.log(`Try Set Private : ${value}`);
            this.SetPrivateRoom(client, value);
        });
    }
    
    async SetPrivateRoom(client: SandboxPlayer, value: boolean) {
        await this.setPrivate(value);
        client.send("Log", `Room Set Private : ${this.private}`);
    }
}

👍

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.