Skip to content
Leonid Pospelov edited this page Jul 27, 2019 · 4 revisions

All methods of User return promises or promise-like objects. It's recommended to use them with await keyword:

await someUser.showBrowserWindow(someWindow);

Property: 'id'

String property representing the unique id of the User.

console.log(user.id); // no await

Property: 'actor'

Attached Actor or null.

let actor = await user.actor;
if (actor) {
  await actor.disable();
  await user.setActor(null);
}

.showBrowserWindow(window)

Makes BrowserWindow visible for this user.

await user.showBrowserWindow(someWindow);

.hideBrowserWindow(window)

Makes BrowserWindow invisible for this user.

await user.hideBrowserWindow(someWindow);

.sendCustomPacket(targetSystem, data)

Sends a custom packet to this user.

  • targetSystem - String. Should represent one of the systems in your gamemode.
  • data - A serializable object with the information you want to be sent to the client.
// Frontend JS code has access to passed targetSystem and data
await user.sendCustomPacket('Auth', { error: 'Wrong pass' });

.setActor(actor)

Changes the Actor controlled by this user.

  • actor - An instance of Actor or null (Null value forces Skyrim to exit to the main menu).
if (someCondition) {
  await user.setActor(someActor);
}
else {
  await user.setActor(null);
}
Clone this wiki locally