GetServerConfigSetting: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (If the setting name is 'serverip', may(...))
(One intermediate revision by one other user not shown)
Line 16: Line 16:


===Returns===
===Returns===
Returns a string containing the current value for the named setting, or ''false'' if the setting does not exist.
Returns a string containing the current value for the named setting, or ''false'' if the setting does not exist.<br>
May return the string "auto" on local servers.
If the setting name is ''serverip'', may return the string ''"auto"'' on local servers.


==Example==
==Example==

Revision as of 20:28, 16 May 2020

This function retrieves server settings which are usually stored in the mtaserver.conf file.

Available in 1.1 and onwards

Syntax

string getServerConfigSetting ( string name )

Required Arguments

  • name : The name of the setting (setting names can be found here)

Returns

Returns a string containing the current value for the named setting, or false if the setting does not exist.
If the setting name is serverip, may return the string "auto" on local servers.

Example

This example prints the server minimum allowed client version to the chatbox

outputChatBox( getServerConfigSetting ("minclientversion") )

This example creates a getServerIP helper function:

function getServerIP()
    return getServerConfigSetting("serverip")
end

See Also