Sidebar App
// Function that works when the sidebar app is touched (clicked).
App.onSidebarTouched.Add(function (p) {
p.tag.widget = p.showWidget("widget.html", "sidebar", 350, 350);
p.tag.widget.onMessage.Add(function (player, data) {
if (data.type == "close") {
player.showCenterLabel("Widget has been closed.");
player.tag.widget.destroy();
player.tag.widget = null;
}
});
});
// Function is called when the player enters
App.onJoinPlayer.Add(function (p) {
p.tag = {
widget: null,
};
});
// Function is called when the player exits
App.onLeavePlayer.Add(function (p) {
if (p.tag.widget) {
p.tag.widget.destroy();
p.tag.widget = null;
}
});
Last updated
Was this helpful?