How do you access variables from the server.cfg?

I read that it is possible to access variables specified in the server.cfg but I cannot find any script using it or any other examples on the forums or your documentation.

Does someone know a way on how to access those variables in lua scripts?

And is it by any chances possible to access variables like sv_maxclients? I don’t want to specify them again in a separate script to avoid confusion once we get a stable release of OneSync or similar updates :slight_smile:

Example from the documentation:

# convars which can be used in scripts
set temp_convar "hey world!"

# Server player slot limit (must be between 1 and 32)
sv_maxclients 32
1 Like

Use the GetConvar() native

2 Likes

Thanks a lot!

I also had made another mistake: I put the variables below all the resources instead of above them.

Now it is working as intended.

1 Like