Hosting & infrastructure

Convars

Also called console variables, set setr sets

Named configuration values set in server.cfg or the console with set, setr or sets, read by the server and by resources at runtime.

Convars are the configuration variables FiveM servers use for nearly everything. Some are built in, like sv_maxclients and sv_enforceGameBuild; others are defined by resources, like oxmysql's mysql_connection_string. They are usually set in server.cfg.

There are three setters, and the difference matters:

  • set name value creates a server-only convar. Clients cannot read it.
  • setr name value creates a replicated convar that clients can read. Use it for values client scripts need, never for secrets.
  • sets name value creates a server info convar that is published with your listing. Tags, locale and banners use this, for example sets tags "roleplay, esx".

Built-in convars like sv_maxclients are set without a prefix in many configs, and that works because the engine already knows them.

Resources read convars with GetConvar and GetConvarInt, which take a default for when the value is missing. That lets one resource behave differently on staging and production without code changes.

The most common mistakes are putting a password in a setr or sets convar, which publishes it to clients or the list, and setting a convar after the line that ensures the resource that reads it at startup. Order in server.cfg is execution order.

Convars can also be passed on the command line with +set name value, which is how some hosts inject values like the licence key without writing them to the config file.

Related terms

Trying to get your server seen?

The live leaderboard shows what the numbers look like at the top of the list, and the upvote calculator turns a target server into a campaign size. The full glossary is here.