Fitting your server

Characters and character select

How the studio logs players into characters and makes a test character on any framework.

Characters in the session (the account’s character list, Log in, the test character “Gracz N”) go through the character.* capabilities. They come from the adapter of the resource that handles character select on your server. That is often a separate resource, not the framework’s core: esx_multicharacter on ESX, qb-multicharacter on QBCore, the core itself on Qbox and ox_core.

Capabilities

Capability Side What it does
character.list server The player’s account characters: { id, name, job? }.
character.login server Loads the character with the given id. The server can do it, or a click on the in-game character select.
character.create server Makes a character and enters it at once.
character.prepare server Adds characters to the account before the select reads them (when a new character cannot be loaded without joining again).
character.selectOpen player true while the player sees the character select.
character.spawn player After the server loaded the character, closes the select and lets the player into the game.
character.prepareSpawn server Settles what the resource would show before play (a starting apartment choice, for example).

What the session shows

  • Without character.list the session shows the player at character select with no list: pick the character in the game.
  • With character.list and character.login the account’s characters are listed with Log in.
  • Join straight away with the studio test character appears when the project has character.selectOpen, character.list, character.login and character.create or character.prepare.

Test character

When the game reports the character select open, the studio looks for “Gracz N” on the account. If it is there, it loads it. If not, it makes it with character.create. When the project has only character.prepare, the studio adds the character when the player joins the server, and the select shows it the next time.

Player 2 on the same account

Player 1 and Player 2 have the same Rockstar license, and frameworks drop a second player with a license already on the server. An adapter can have a patches field in adapter.json: one-line edits in the resource’s files that skip that check only while the studio runs Player 2 (the studio_player2 convar).

"patches": [
  {
    "file": "server/events.lua",
    "find": "elseif config.checkLicense and inUse(license) then",
    "replace": "elseif config.checkLicense and not (GetConvar('studio_player2', 'false') == 'true') and inUse(license) then"
  }
]

The studio applies patches before every server start. A file in another version, without the expected line, is left as it is, and Output says so once. Changed files show in the change list of a deploy. Without Player 2, and outside the studio, the framework checks licenses as usual.

A resource that can let a second player in without changed files (a config switch, for example) does it in the session.secondPlayer capability: the studio calls it when it starts Player 2.

testConvars in adapter.json sets convars only on the studio’s server and only with the test character on, for example a character select switched off so the studio picks the character itself.

A question this page does not answer? Ask it on Discord.

Webexe Studio

Click to see it at 100%.