Skip to content
GAMPEONCreate
New project
Preview: this works today, but details can still change.

Convars

Server settings from server.cfg (set, setr, sets) that scripts can read.

GetConvar(varName, default) --> string

Read a convar as text. Server and client.

Parameter Type Description
varName string Name, for example “sv_hostname”.
default string Returned if the convar is not set.

Returns

  • string: The value or the default.
local locale = GetConvar('myres_locale', 'en')

Compared to FiveM: Same as in FiveM. On the client only replicated convars (setr) are visible. Protected convars (for example the server key) always return the default.

GetConvarInt(varName, default) --> integer

Read a convar as a whole number. Server and client.

Parameter Type Description
varName string Name.
default integer Returned if the convar is not set or not a number.

Returns

  • integer: The value or the default.
local slots = GetConvarInt('sv_maxclients', 64)

Compared to FiveM: Same as in FiveM.

GetConvarFloat(varName, default) --> number

Read a convar as a number with decimals. Server and client.

Parameter Type Description
varName string Name.
default number Returned if the convar is not set or not a number.

Returns

  • number: The value or the default.
local rate = GetConvarFloat('myres_tax', 0.19)

Compared to FiveM: Same as in FiveM.

GetConvarBool(varName, default) --> boolean

Read a convar as true or false. Server and client.

Parameter Type Description
varName string Name.
default boolean Returned if the convar is not set or not a yes/no value.

Returns

  • boolean: true for true, 1, yes, on; false for false, 0, no, off; otherwise the default.
if GetConvarBool('myres_debug', false) then print('debug on') end

Compared to FiveM: Same as in FiveM.

SetConvar(varName, value)

Set a convar on the server. Server only.

Parameter Type Description
varName string Name.
value string New value.
SetConvar('myres_mode', 'event')

Compared to FiveM: Same as in FiveM. Protected convars cannot be changed.

SetConvarReplicated(varName, value)

Set a convar that clients can read too. Server only.

Parameter Type Description
varName string Name.
value string New value.
SetConvarReplicated('myres_theme', 'dark')

Compared to FiveM: Same as in FiveM.

SetConvarServerInfo(varName, value)

Set a convar that is shown in the server list. Server only.

Parameter Type Description
varName string Name.
value string New value.
SetConvarServerInfo('tags', 'roleplay,economy')

Compared to FiveM: Same as in FiveM.

Report a problem with this pageOther ways to give feedback