Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var username, password, worldid;
- username = "guest";
- password = "guest";
- worldid = "PWiD05QMRyb0I";
- var cli, cfg, con;
- PlayerIO.authenticate("everybody-edits-su9rn58o40itdbnw69plyw", "simpleUsers", { username: username, password: password }, {}, loginSuccess, fail("Authenticate"));
- function loginSuccess(client) {
- cli = client;
- cli.bigDB.load("config", "config", configSuccess, fail("Config"));
- }
- function configSuccess(config) {
- cfg = config;
- cli.multiplayer.createJoinRoom(worldid, "Everybodyedits" + cfg.version, true, null, null, connectSuccess, fail("Connect"));
- }
- function connectSuccess(connection) {
- con = connection;
- con.send("init");
- con.addMessageCallback("*", onMessage);
- }
- function fail(location) {
- return error => console.log("Location: " + location + ", Error: " + error.code + ", Message: " + error.message);
- }
- function onMessage(msg) {
- switch (msg.type) {
- case "init":
- con.send("init2");
- break;
- case "init2":
- console.log("Success!");
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement